Skip to content

Commit

Permalink
Updated documentation examples
Browse files Browse the repository at this point in the history
  • Loading branch information
vderyushev committed Jul 10, 2024
1 parent c0e1136 commit be15c22
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,34 +95,37 @@ public void DigitallySignedPdfUsingCertificateHolder()
[Test]
public void EmbeddedAllFonts()
{
//ExStart:EmbeddAllFonts
//ExStart:EmbeddedAllFonts
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

// The output PDF will be embedded with all fonts found in the document.
PdfSaveOptions saveOptions = new PdfSaveOptions { EmbedFullFonts = true };

doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.EmbeddedFontsInPdf.pdf", saveOptions);
//ExEnd:EmbeddAllFonts
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.EmbeddedAllFonts.pdf", saveOptions);
//ExEnd:EmbeddedAllFonts
}

[Test]
public void EmbeddedSubsetFonts()
{
//ExStart:EmbeddSubsetFonts
//ExStart:EmbeddedSubsetFonts
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

// The output PDF will contain subsets of the fonts in the document.
// Only the glyphs used in the document are included in the PDF fonts.
PdfSaveOptions saveOptions = new PdfSaveOptions { EmbedFullFonts = false };

doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.EmbeddSubsetFonts.pdf", saveOptions);
//ExEnd:EmbeddSubsetFonts
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.EmbeddedSubsetFonts.pdf", saveOptions);
//ExEnd:EmbeddedSubsetFonts
}

[Test]
public void DisableEmbedWindowsFonts()
{
//ExStart:DisableEmbedWindowsFonts
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

// The output PDF will be saved without embedding standard windows fonts.
Expand All @@ -148,6 +151,7 @@ public void SkipEmbeddedArialAndTimesRomanFonts()
public void AvoidEmbeddingCoreFonts()
{
//ExStart:AvoidEmbeddingCoreFonts
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

// The output PDF will not be embedded with core fonts such as Arial, Times New Roman etc.
Expand Down Expand Up @@ -178,6 +182,7 @@ public void EscapeUri()
public void ExportHeaderFooterBookmarks()
{
//ExStart:ExportHeaderFooterBookmarks
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Bookmarks in headers and footers.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions();
Expand Down Expand Up @@ -236,6 +241,7 @@ public void ConversionToPdf17()
public void DownsamplingImages()
{
//ExStart:DownsamplingImages
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

// We can set a minimum threshold for downsampling.
Expand All @@ -250,23 +256,25 @@ public void DownsamplingImages()
}

[Test]
public void SetOutlineOptions()
public void OutlineOptions()
{
//ExStart:SetOutlineOptions
//ExStart:OutlineOptions
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions();
saveOptions.OutlineOptions.HeadingsOutlineLevels = 3;
saveOptions.OutlineOptions.ExpandedOutlineLevels = 1;

doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.SetOutlineOptions.pdf", saveOptions);
//ExEnd:SetOutlineOptions
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.OutlineOptions.pdf", saveOptions);
//ExEnd:OutlineOptions
}

[Test]
public void CustomPropertiesExport()
{
//ExStart:CustomPropertiesExport
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document();
doc.CustomDocumentProperties.Add("Company", "Aspose");

Expand All @@ -280,6 +288,7 @@ public void CustomPropertiesExport()
public void ExportDocumentStructure()
{
//ExStart:ExportDocumentStructure
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Paragraphs.docx");

// The file size will be increased and the structure will be visible in the "Content" navigation pane
Expand All @@ -293,15 +302,16 @@ public void ExportDocumentStructure()
[Test]
public void ImageCompression()
{
//ExStart:PdfImageCompression
//ExStart:ImageCompression
//GistId:6debb84fc15c7e5b8e35384d9c116215
Document doc = new Document(MyDir + "Rendering.docx");

PdfSaveOptions saveOptions = new PdfSaveOptions
{
ImageCompression = PdfImageCompression.Jpeg, PreserveFormFields = true
};

doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.PdfImageCompression.pdf", saveOptions);
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.ImageCompression.pdf", saveOptions);

PdfSaveOptions saveOptionsA2U = new PdfSaveOptions
{
Expand All @@ -312,8 +322,8 @@ public void ImageCompression()



doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.PdfImageCompression_A2u.pdf", saveOptionsA2U);
//ExEnd:PdfImageComppression
doc.Save(ArtifactsDir + "WorkingWithPdfSaveOptions.ImageCompression_A2u.pdf", saveOptionsA2U);
//ExEnd:ImageCompression
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ public void RemoveCommentsInPdf()
public void ShowRevisionsInBalloons()
{
//ExStart:ShowRevisionsInBalloons
//GistId:ce015d9bade4e0294485ffb47462ded4
//ExStart:SetMeasurementUnit
//ExStart:SetRevisionBarsPosition
Document doc = new Document(MyDir + "Revisions.docx");
Expand Down

0 comments on commit be15c22

Please sign in to comment.