Skip to content

Commit 421a271

Browse files
Merge pull request #206 from SyncfusionExamples/986455
986455: Updated load and save changes in PDF example code
2 parents abadcc7 + f85ee71 commit 421a271

File tree

183 files changed

+2927
-4372
lines changed
  • Actions
    • Add-GoTo-action-to-the-PDF-document/.NET/Add-GoTo-action-to-the-PDF-document
    • Add-JavaScript-action-to-the-PDF-document/.NET/Add-JavaScript-action-to-the-PDF-document
    • Add-URI-action-to-the-PDF-document/.NET/Add-URI-action-to-the-PDF-document
    • Add-action-to-the-PDF-document/.NET/Add-action-to-the-PDF-document
    • Add-actions-to-the-existing-PDF-document/.NET/Add-actions-to-the-existing-PDF-document
    • Add-lauch-action-to-PDF-document/.NET/Add-lauch-action-to-PDF-document
    • Add-named-action-to-PDF-document/.NET/Add-named-action-to-PDF-document
    • Add-submit-action-to-the-PDF-document/.NET/Add-submit-action-to-the-PDF-document
    • Add-the-sound-action-to-PDF-document/.NET/Add-the-sound-action-to-PDF-document
    • Adding-Document-Level JavaScript-Actions/.NET/Adding-Document-Level JavaScript-Actions
    • Adding-an-action-to-the-bookmark-in-the-PDF-document/.NET/Adding-an-action-to-the-bookmark-in-the-PDF-document
    • Adding-an-action-to-the-form-fields-in-PDF-document/.NET/Adding-an-action-to-the-form-fields-in-PDF-document
    • Remove-Document-Level-JavaScript-Actions/.NET/Remove-Document-Level-JavaScript-Actions
    • Reset-form-fields-in-the-PDF-document/.NET/Reset-form-fields-in-the-PDF-document
    • Retrieve-Document-Level-JavaScript-Actions/.NET/Retrieve-Document-Level-JavaScript-Actions
  • Annotation
    • Add-URI-annotation-in-a-PDF-document/.NET/Add-URI-annotation-in-a-PDF-document
    • Add-a-3D-annotation-in-PDF-document/.NET/Add-a-3D-annotation-in-PDF-document
    • Add-a-circle-measurement-annotation-to-the-PDF-document/.NET/Add-a-circle-measurement-annotation-to-the-PDF-document
    • Add-a-cloud-border-styled-polygon-annotation-in-the-PDF/.NET/Add-a-cloud-border-styled-polygon-annotation-in-the-PDF
    • Add-a-free-text-annotation-in-the-PDF-document/.NET/Add-a-free-text-annotation-in-the-PDF-document
    • Add-a-line-measurement-annotation-to-the-PDF-document/.NET/Add-a-line-measurement-annotation-to-the-PDF-document
    • Add-a-popup-annotation-to-an-existing-PDF-document/.NET/Add-a-popup-annotation-to-an-existing-PDF-document
    • Add-a-popup-annotation-to-the-PDF-document/.NET/Add-a-popup-annotation-to-the-PDF-document
    • Add-a-review-status-in-a-newly-created-PDF-annotation/.NET/Add-a-review-status-in-a-newly-created-PDF-annotation
    • Add-a-sound-annotation-in-a-PDF-document/.NET/Add-a-sound-annotation-in-a-PDF-document
    • Add-a-square-measurement-annotation-to-PDF-document/.NET/Add-a-square-measurement-annotation-to-PDF-document
    • Add-angle-measurement-annotation-to-PDF-document/.NET-Framework/Add-angle-measurement-annotation-to-PDF-document
    • Add-cloud-border-styled-circle-annotation-in-the-PDF/.NET/Add-cloud-border-styled-circle-annotation-in-the-PDF
    • Add-cloud-border-styled-ellipse-annotation-in-the-PDF/.NET/Add-cloud-border-styled-ellipse-annotation-in-the-PDF
    • Add-cloud-border-styled-rectangle-annotation-in-the-PDF/.NET/Add-cloud-border-styled-rectangle-annotation-in-the-PDF
    • Add-comments-to-the-PDF-annotation/.NET/Add-comments-to-the-PDF-annotation
    • Add-comments-to-the-existing-PDF-annotation/.NET/Add-comments-to-the-existing-PDF-annotation
    • Add-custom-stamp-in-an-existing-PDF-document/.NET/Add-custom-stamp-in-an-existing-PDF-document
    • Add-file-attachment-annotation-in-a-PDF-document/.NET/Add-file-attachment-annotation-in-a-PDF-document
    • Add-ink-annotation-to-the-PDF-document/.NET/Add-ink-annotation-to-the-PDF-document
    • Add-line-annotation-to-the-PDF-document/.NET/Add-line-annotation-to-the-PDF-document
    • Add-popup-annotation-in-a-PDF-document/.NET/Add-popup-annotation-in-a-PDF-document
    • Add-rich-media-annotation-to-PDF-document/.NET/Add-rich-media-annotation-to-PDF-document
    • Add-rubberstamp-annotation-to-the-PDF-document/.NET/Add-rubberstamp-annotation-to-the-PDF-document
    • Add-the-JavaScript-script-to-the-3D-annotation-in-a-PDF/.NET/Add-the-JavaScript-script-to-the-3D-annotation-in-a-PDF
    • Add-the-review-status-to-the-existing-PDF-annotation/.NET/Add-the-review-status-to-the-existing-PDF-annotation
    • Add-watermark-annotation-in-the-PDF-document/.NET/Add-watermark-annotation-in-the-PDF-document
    • Adding-quad-points-to-existing-redaction-annotations/.NET/Adding-quad-points-to-existing-redaction-annotations
    • Adding-transparency-for-annotations/.NET/Adding-transparency-for-annotations
    • Exporting-Newly-Added-Annotations-FDF-File/.NET/Exporting-Newly-Added-Annotations-FDF-File
    • Exporting-Newly-Added-Annotations-JSON-File/.NET/Exporting-Newly-Added-Annotations-JSON-File
    • Exporting-Newly-Added-Annotations-XFDF-File/.NET/Exporting-Newly-Added-Annotations-XFDF-File
    • Exporting-annotation-to-FDF-file-from-PDF-document/.NET/Exporting-annotation-to-FDF-file-from-PDF-document
    • Exporting-annotations-to-JSON-file-from-PDF-document/.NET/Exporting-annotations-to-JSON-file-from-PDF-document
    • Exporting-annotations-to-XFDF-file-from-PDF-document/.NET/Exporting-annotations-to-XFDF-file-from-PDF-document
    • Flatten-popup-annotation-in-the-PDF-document/.NET/Flatten-popup-annotation-in-the-PDF-document
    • Flatten-specific-types-of-annotations/.NET/Flatten-specific-types-of-annotations
    • Flatten-the-annotations-in-an-existing-PDF-document/.NET/Flatten-the-annotations-in-an-existing-PDF-document
    • Flatten-the-specific-annotaiton-in-the-PDF-document/.NET/Flatten-the-specific-annotaiton-in-the-PDF-document
    • Flattening-annotations-with-popups-in-PDF/.NET/Flattening-annotations-with-popups-in-PDF
    • Flattening-annotations-without-calling-save-method/.NET/Flattening-annotations-without-calling-save-method
    • Get-annotation-creation-date-from-PDF/.NET/Get-annotation-creation-date-from-pdf
    • Get-annotation-type-from-pdf/.NET/Get-annotation-type-from-pdf
    • Get-the-ink-list-points-from-the-existing-PDF-document/.NET/Get-the-ink-list-points-from-the-existing-PDF-document
    • Get-value-from-PDF-annotation/.NET/Get-value-from-PDF-annotation
    • Highlight-text-in-the-newly-created-PDF-document/.NET/Highlight-text-in-the-newly-created-PDF-document
    • Importing-annotations-from-FDF-file-to-PDF-document/.NET/Importing-annotations-from-FDF-file-to-PDF-document
    • Importing-annotations-from-JSON-file-to-PDF-document/.NET/Importing-annotations-from-JSON-file-to-PDF-document
    • Importing-annotations-from-XFDF-file-to-PDF-document/.NET/Importing-annotations-from-XFDF-file-to-PDF-document
    • Modify-comments-in-the-existing-PDF-annotation/.NET/Modify-comments-in-the-existing-PDF-annotation
    • Modify-review-status-to-the-existing-PDF-annotation/.NET/Modify-review-status-to-the-existing-PDF-annotation
    • Modify-the-redaction-annotation-in-PDF-document/.NET/Modify-the-redaction-annotation-in-PDF-document
    • Modifying-annotation-of-existing-PDF-document/.NET/Modifying-annotation-of-existing-PDF-document
    • Multi-line-text-redaction-using-quad-points/.NET/Multi-line-text-redaction-using-quad-points
    • Print-annotation-in-the-PDF-document/.NET/Print-annotation-in-the-PDF-document
    • Remove-commets-from-the-existing-PDF-annotation/.NET/Remove-commets-from-the-existing-PDF-annotation
    • Remove-review-status-to-the-existing-PDF-document/.NET/Remove-review-status-to-the-existing-PDF-document
    • Removing-annotations-from-an-existing-PDF-document/.NET/Removing-annotations-from-an-existing-PDF-document
    • Removing-the-sensitive-text-and-images-from-PDF-document/.NET/Removing-the-sensitive-text-and-images-from-PDF-document
    • Retrieve-review-status-from-the-existing-PDF-annotations/.NET
    • Retrieve-the-annotation-comments-from-the-existing-PDF/.NET
    • Set-text-alignment-in-a-Combo-Box-field/.NET/Set-text-alignment-in-a-Combo-Box-field
    • Set-value-from-PDF-annotation/.NET/Set-value-from-PDF-annotation
  • Attachment
    • Adding-PDF-Attachments-with-Interactive-Launch-Buttons/.NET/Adding-PDF-Attachments-with-Interactive-Launch-Buttons
    • Adding-attachment-to-a-PDF-document/.NET/Adding-attachment-to-a-PDF-document
    • Adding-the-attachments-to-an-existing-PDF-document/.NET/Adding-the-attachments-to-an-existing-PDF-document
    • Extract-and-saving-an-attachment-to-the-disk/.NET/Extract-and-saving-an-attachment-to-the-disk
    • Remove-attachment-from-an-existing-PDF-document/.NET/Remove-attachment-from-an-existing-PDF-document
  • Barcode
    • Add-a-barcode-to-the-PDF-document-without-displaying-text/.NET
    • Adding-quiet-zones-to-a-barcode/.NET/Adding-quiet-zones-to-a-barcode
    • Export-one-dimensional-barcode-as-image/.NET/Export-one-dimensional-barcode-as-image
    • Export-two-dimensional-barcode-as-image/.NET/Export-two-dimensional-barcode-as-image
    • One dimensional barcode
      • Add-Code39-barcode-to-the-PDF-document/.NET/Add-Code39-barcode-to-the-PDF-document
      • Add-PdfEan13-barcode-to-a-PDF-document/.NET/Add-PdfEan13-barcode-to-a-PDF-document
      • Add-PdfEan8-barcode-to-a-PDF-document/.NET/Add-PdfEan8-barcode-to-a-PDF-document
    • Set-location-and-size-to-the-barcode-in-a-PDF-document/.NET/Set-location-and-size-to-the-barcode-in-a-PDF-document
    • Two dimensional barcode
      • Add-a-Pdf417-barcode-to-the-PDF-document/.NET/Add-a-Pdf417-barcode-to-the-PDF-document
      • Add-a-QRBarcode-to-the-PDF-document/.NET/Add-a-QRBarcode-to-the-PDF-document
  • Bookmarks
    • Adding-a-child-to-the-bookmarks-in-a-PDF/.NET/Adding-a-child-to-the-bookmarks-in-a-PDF
    • Adding-bookmarks-in-a-PDF-document/.NET/Adding-bookmarks-in-a-PDF-document
    • Adding-bookmarks-in-an-existing-PDF-document/.NET/Adding-bookmarks-in-an-existing-PDF-document
    • Get-bookmark-page-index-from-the-existing-PDF-document/.NET/Get-bookmark-page-index-from-the-existing-PDF-document
    • Inserting-bookmarks-in-an-existing-PDF/.NET/Inserting-bookmarks-in-an-existing-PDF
    • Modify-the-bookmarks-in-an-existing-PDF-document/.NET/Modify-the-bookmarks-in-an-existing-PDF-document
    • Remove-bookmarks-from-an-existing-PDF-document/.NET/Remove-bookmarks-from-an-existing-PDF-document
  • Brushes
    • Draw-shape-on-PDF-with-tiling-brush/.NET/Draw-shape-on-PDF-with-tiling-brush
    • Draw-shapes-on-PDF-with-radial-gradient-brush/.NET/Draw-shapes-on-PDF-with-radial-gradient-brush
    • Fill-an-object-with-gradient-brush-in-a-PDF/.NET/Fill-an-object-with-gradient-brush-in-a-PDF
    • Fill-an-object-with-solid-brush-in-a-PDF/.NET/Fill-an-object-with-solid-brush-in-a-PDF
    • Hatch-brush/.NET/Hatch-brush
    • Linear-Gradient-Brush-with-Multiple-Colors/.NET/Linear-Gradient-Brush-with-Multiple-Colors
    • Radial-gradient-rectangle-in-PDF/.NET/Radial-gradient-rectangle-in-PDF
  • ColorSpace
    • Add-color-space-in-particular-object-in-an-existing-PDF/.NET/Add-color-space-in-particular-object-in-an-existing-PDF
    • Add-graphics-elemets-by-Pantone-color-in-existing-PDF/.NET/Add-graphics-elemets-by-Pantone-color-in-existing-PDF
    • Create-PDF-document-with-ICC-color-space/.NET/Create-PDF-document-with-ICC-color-space
    • Draw-graphics-elements-by-using-Pantone-colors-in-a-PDF/.NET/Draw-graphics-elements-by-using-Pantone-colors-in-a-PDF
    • Draw-rectangle-on-new-PDF-with-CalGray-brush/.NET/Draw-rectangle-on-new-PDF-with-CalGray-brush
    • Draw-rectangle-with-CalGray-brush-in-an-existing-PDF/.NET/Draw-rectangle-with-CalGray-brush-in-an-existing-PDF
    • Set-ICC-color-space-in-an-existing-PDF-document/.NET/Set-ICC-color-space-in-an-existing-PDF-document
    • Use-color-space-in-particular-object-in-a-new-PDF/.NET/Use-color-space-in-particular-object-in-a-new-PDF
  • Compression
    • Compress-and-replace-image-in-a-PDF-document/.NET-Framework/Compress-and-replace-image-in-a-PDF-document
    • Compress-quality-of-image-in-PDF-document/.NET-Framework/Compress-quality-of-image-in-PDF-document
    • Compress-the-content-of-the-PDF-document/.NET/Compress-the-content-of-the-PDF-document
    • Compress-the-existing-PDF-document/.NET/Compress-the-existing-PDF-document
    • Compress-the-images-in-an-existing-PDF-document/.NET/Compress-the-images-in-an-existing-PDF-document
    • Optimize-embedded-font-in-an-existing-PDF-document/.NET/Optimize-embedded-font-in-an-existing-PDF-document
    • Optimize-page-contents-in-an-existing-PDF-document/.NET/Optimize-page-contents-in-an-existing-PDF-document
    • Reduce-PDF-file-size-by-removing-PDF-metadata/.NET/Reduce-PDF-file-size-by-removing-PDF-metadata
  • Document conversion
    • Converting-XPS-to-PDF-document/.NET/Converting-XPS-to-PDF-document
    • Excel-to-PDF
      • Convert-workbook-to-PDF-document/.NET/Convert-workbook-to-PDF-document
      • Converting-Excel-with-chart-to-PDF-document/.NET/Converting-Excel-with-chart-to-PDF-document
      • Converting-a-worksheet-to-PDF-document/.NET/Converting-a-worksheet-to-PDF-document
      • Creating-individual-PDF-document-for-each-worksheet/.NET
    • RTF-to-PDF/Convert-RTF-to-PDF-document/.NET/Convert-RTF-to-PDF-document
    • TIFF-to-PDF/Converting-multipage-TIFF-to-PDF-document/.NET/Converting-multipage-TIFF-to-PDF-document
    • Word-to-PDF/Converting-Word-to-PDF-document/.NET/Converting-Word-to-PDF-document
  • Redaction
    • Display-text-on-the-redacted-area/.NET/Display-text-on-the-redacted-area
    • Draw-image-on-the-redacted-area-in-PDF-document/.NET/Draw-image-on-the-redacted-area-in-PDF-document
    • Draw-pattern-on-the-redacted-area-in-PDF-document/.NET/Draw-pattern-on-the-redacted-area-in-PDF-document
    • Fill-color-on-the-redacted-area-in-a-PDF/.NET/Fill-color-on-the-redacted-area-in-a-PDF
    • Find-text-by-regular-expression-pattern-and-redact-it-from-PDF-document/.NET/Find_text_by_regular_expression
    • Get-the-redaction-progress-from-PDF-document/.NET/Get-the-redaction-progress-from-PDF-document
    • Get-the-result-of-redaction-with-other-information/.NET/Get-the-result-of-redaction-with-other-information
    • Redact-text-content-alone-on-the-redated-area/.NET
    • Redaction-fill-color-customization/.NET/Redaction-fill-color-customization
    • Redaction-without-fill-color-and-appearance/.NET/Redaction-without-fill-color-and-appearance
    • Removing-sensitive-content-from-the-PDF-document/.NET/Removing-sensitive-content-from-the-PDF-document
  • Save-PDF-file
  • Split PDFs
    • Import-multiple-pages-from-an-existing-PDF/.NET/Import-multiple-pages-from-an-existing-PDF
    • Import-pages-from-multiple-documents-and-arrange-pages/.NET/Import-pages-from-multiple-documents-and-arrange-pages
    • Import-tagged-structure-when-splitting-PDF-documents/.NET/Import-tagged-structure-when-splitting-PDF-documents
    • Importing-pages-from-one-document-another-document/.NET/Importing-pages-from-one-document-another-document
    • Password-Protect-Split-PDF/.NET/Password-Protect-Split-PDF
    • Rearrange-Page-and-Split/.NET/Rearrange-Page-and-Split
    • Remove-Unused-Resources-when-Splitting-PDF-Documents/.NET/Remove-Unused-Resources-when-Splitting-PDF-Documents
    • Rotate-PDF-and-Split/.NET/Rotate-PDF-and-Split
    • Split-PDF-based-Bookmarks/.NET/Split-PDF-based-Bookmarks
    • Split-a-Range-of-Pages/.NET/Split-a-Range-of-Pages
    • Split-by-FixedNumber/.NET/Split-by-FixedNumber
  • Table/PdfLightTable
    • Add-string-formatting-for-whole-table-in-a-PDF/.NET/Add-string-formatting-for-whole-table-in-a-PDF
    • Add-string-formatting-to-a-column-in-table/.NET/Add-string-formatting-to-a-column-in-table
    • Add-the-data-directly-into-the-PDF-table/.NET/Add-the-data-directly-into-the-PDF-table
    • Column-customization-of-the-table-in-PDF-document/.NET/Column-customization-of-the-table-in-PDF-document
    • Create-simple-table-from-data-source/.NET/Create-simple-table-from-data-source
    • Create-table-with-built-in-style/.NET/Create-table-with-built-in-style
    • Creating-the-table-in-an-existing-PDF-document/.NET/Creating-the-table-in-an-existing-PDF-document
    • Customize-the-table-cell-in-PDF-document/.NET/Customize-the-table-cell-in-PDF-document
    • Customize-the-table-in-a-PDF-document/.NET/Customize-the-table-in-a-PDF-document
    • Draw-graphics-element-in-particular-cell/.NET/Draw-graphics-element-in-particular-cell
    • Paginate-table-in-a-PDF-document/.NET/Paginate-table-in-a-PDF-document
    • Row-customization-of-the-table-in-PDF-document/.NET/Row-customization-of-the-table-in-PDF-document
  • Text Extraction
    • Extract-collection-of-words-from-PDF-document/.NET/Extract-collection-of-words-from-PDF-document
    • Extract-each-lines-from-an-existing-PDF-document/.NET/Extract-each-lines-from-an-existing-PDF-document
    • Extract-text-from-the-entire-PDF-document/.NET/Extract-text-from-the-entire-PDF-document
    • Extract-the-text-with-layout-in-a-PDF-document/.NET/Extract-the-text-with-layout-in-a-PDF-document
    • Extract-the-texts-from-a-page-in-the-PDF-document/.NET/Extract-the-texts-from-a-page-in-the-PDF-document
    • Get-text-glyph-details-from-extract-text/.NET/Get-text-glyph-details-from-extract-text
  • Watermark
    • Add-text-watermark-in-an-existing-PDF-document/.NET/Add-text-watermark-in-an-existing-PDF-document
    • Adding-image-watermark-in-PDF-document/.NET/Adding-image-watermark-in-PDF-document
    • Adding-text-watermark-in-PDF-document/.NET/Adding-text-watermark-in-PDF-document
    • Draw-the-image-watermark-in-an-existing-PDF-document/.NET/Draw-the-image-watermark-in-an-existing-PDF-document
    • Removing-watermark-annotation-in-PDF-document/.NET/Remove-watermark-annotation-in-the-PDF-document
  • ZUGFeRD
    • Create-ZUGFeRD-compliment-PDF-invoice/.NET/Create-ZUGFeRD-compliment-PDF-invoice
    • Extract-ZUGFeRD-invoice-from-PDF-document/.NET/Extract-ZUGFeRD-invoice-from-PDF-document
    • Factur-X/.NET/Factur-X

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

183 files changed

+2927
-4372
lines changed
Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Interactive;
64

7-
//Create a new document.
8-
PdfDocument document = new PdfDocument();
9-
10-
//Add first page.
11-
PdfPage page = document.Pages.Add();
5+
//Create a new PDF document.
6+
using (PdfDocument document = new PdfDocument())
7+
{
8+
//Add first page.
9+
PdfPage page = document.Pages.Add();
1210

13-
//Add second page.
14-
PdfPage secondPage = document.Pages.Add();
11+
//Add second page.
12+
PdfPage secondPage = document.Pages.Add();
1513

16-
//Set the goto action.
17-
PdfGoToAction gotoAction = new PdfGoToAction(secondPage);
14+
//Set the goto action.
15+
PdfGoToAction gotoAction = new PdfGoToAction(secondPage);
1816

19-
//Set destination location.
20-
gotoAction.Destination = new PdfDestination(secondPage, new PointF(0, 100));
17+
//Set destination location.
18+
gotoAction.Destination = new PdfDestination(secondPage, new PointF(0, 100));
2119

22-
//Add the action to the document.
23-
document.Actions.AfterOpen = gotoAction;
20+
//Add the action to the document.
21+
document.Actions.AfterOpen = gotoAction;
2422

25-
//Create file stream.
26-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
27-
{
28-
//Save the PDF document to file stream.
29-
document.Save(outputFileStream);
23+
//Save the PDF document
24+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
3025
}
3126

32-
//Close the document.
33-
document.Close(true);
34-
Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

6-
//Create a new document.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Add a page.
10-
PdfPage page = document.Pages.Add();
4+
//Create a new PDF document.
5+
using (PdfDocument document = new PdfDocument())
6+
{
7+
//Add a page.
8+
PdfPage page = document.Pages.Add();
119

12-
//Create JavaScript action.
13-
PdfJavaScriptAction scriptAction = new PdfJavaScriptAction("app.alert(\"Hello World!!!\")");
10+
//Create JavaScript action.
11+
PdfJavaScriptAction scriptAction = new PdfJavaScriptAction("app.alert(\"Hello World!!!\")");
1412

15-
//Add the JavaScript action.
16-
document.Actions.AfterOpen = scriptAction;
13+
//Add the JavaScript action.
14+
document.Actions.AfterOpen = scriptAction;
1715

18-
//Create file stream.
19-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
20-
{
21-
//Save the PDF document to file stream.
22-
document.Save(outputFileStream);
16+
//Save the PDF document
17+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
2318
}
2419

25-
//Close the document.
26-
document.Close(true);
27-
Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

6-
//Create a new document with PDF/A standard.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Create a uri action.
10-
PdfUriAction uriAction = new PdfUriAction("http://www.google.com");
11-
12-
//Add the action to the document.
13-
document.Actions.AfterOpen = uriAction;
14-
15-
//Create file stream.
16-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
4+
//Create a new PDF document.
5+
using (PdfDocument document = new PdfDocument())
176
{
18-
//Save the PDF document to file stream.
19-
document.Save(outputFileStream);
20-
}
7+
//Create a uri action.
8+
PdfUriAction uriAction = new PdfUriAction("http://www.google.com");
9+
10+
//Add the action to the document.
11+
document.Actions.AfterOpen = uriAction;
2112

22-
//Close the document.
23-
document.Close(true);
13+
//Save the PDF document
14+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
15+
}
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

64
//Create a new PDF document.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Create and add new launch action to the document.
10-
PdfLaunchAction action = new PdfLaunchAction(Path.GetFullPath(@"Data/logo.png"));
11-
document.Actions.AfterOpen = action;
12-
13-
//Create file stream.
14-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
5+
using (PdfDocument document = new PdfDocument())
156
{
16-
//Save the PDF document to file stream.
17-
document.Save(outputFileStream);
18-
}
7+
//Create and add new launch action to the document.
8+
PdfLaunchAction action = new PdfLaunchAction(Path.GetFullPath(@"Data/logo.png"));
9+
document.Actions.AfterOpen = action;
1910

20-
//Close the document.
21-
document.Close(true);
11+
//Save the PDF document
12+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
13+
}
Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,16 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf.Interactive;
1+
using Syncfusion.Pdf.Interactive;
42
using Syncfusion.Pdf.Parsing;
53

6-
//Get stream from the existing PDF document.
7-
FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Input.pdf"), FileMode.Open, FileAccess.Read);
8-
94
//Load the PDF document.
10-
PdfLoadedDocument loadedDocument = new PdfLoadedDocument(docStream);
5+
using (PdfLoadedDocument loadedDocument = new PdfLoadedDocument(Path.GetFullPath(@"Data/Input.pdf")))
6+
{
117

12-
//Create JavaScript action.
13-
PdfJavaScriptAction scriptAction = new PdfJavaScriptAction("app.alert(\"Hello World!!!\")");
8+
//Create JavaScript action.
9+
PdfJavaScriptAction scriptAction = new PdfJavaScriptAction("app.alert(\"Hello World!!!\")");
1410

15-
//Add the JavaScript action.
16-
loadedDocument.Actions.AfterOpen = scriptAction;
11+
//Add the JavaScript action.
12+
loadedDocument.Actions.AfterOpen = scriptAction;
1713

18-
//Create file stream.
19-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
20-
{
21-
//Save the PDF document to file stream.
22-
loadedDocument.Save(outputFileStream);
14+
//Save the PDF document
15+
loadedDocument.Save(Path.GetFullPath(@"Output/Output.pdf"));
2316
}
24-
25-
//Close the document.
26-
loadedDocument.Close(true);
Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,13 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

64
//Create a new PDF document.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Create and add new launch Action to the document.
10-
PdfLaunchAction action = new PdfLaunchAction(Path.GetFullPath(@"Data/logo.png"));
11-
document.Actions.AfterOpen = action;
12-
13-
//Create file stream.
14-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
5+
using (PdfDocument document = new PdfDocument())
156
{
16-
//Save the PDF document to file stream.
17-
document.Save(outputFileStream);
18-
}
7+
//Create and add new launch Action to the document.
8+
PdfLaunchAction action = new PdfLaunchAction(Path.GetFullPath(@"Data/logo.png"));
9+
document.Actions.AfterOpen = action;
1910

20-
//Close the document.
21-
document.Close(true);
11+
//Save the PDF document
12+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
13+
}
Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

6-
//Create a new document.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Add pages to PDF document.
10-
document.Pages.Add();
11-
document.Pages.Add();
4+
//Create a new PDF document.
5+
using (PdfDocument document = new PdfDocument())
6+
{
7+
//Add pages to PDF document.
8+
document.Pages.Add();
9+
document.Pages.Add();
1210

13-
//Create a named action.
14-
PdfNamedAction namedAction = new PdfNamedAction(PdfActionDestination.LastPage);
11+
//Create a named action.
12+
PdfNamedAction namedAction = new PdfNamedAction(PdfActionDestination.LastPage);
1513

16-
//Add the named action.
17-
document.Actions.AfterOpen = namedAction;
14+
//Add the named action.
15+
document.Actions.AfterOpen = namedAction;
1816

19-
//Create file stream.
20-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
21-
{
22-
//Save the PDF document to file stream.
23-
document.Save(outputFileStream);
17+
//Save the PDF document
18+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
2419
}
2520

26-
//Close the document.
27-
document.Close(true);
28-
Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,26 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Drawing;
1+
using Syncfusion.Drawing;
42
using Syncfusion.Pdf;
53
using Syncfusion.Pdf.Interactive;
64

7-
//Create a PDF document.
8-
PdfDocument document = new PdfDocument();
9-
10-
//Add a new page.
11-
PdfPage page = document.Pages.Add();
12-
13-
//Create a Button field.
14-
PdfButtonField submitButton = new PdfButtonField(page, "Submit data");
5+
//Create a new PDF document.
6+
using (PdfDocument document = new PdfDocument())
7+
{
8+
//Add a new page.
9+
PdfPage page = document.Pages.Add();
1510

16-
//Set the properties to the button field.
17-
submitButton.Bounds = new RectangleF(100, 60, 50, 20);
18-
submitButton.ToolTip = "Submit";
19-
document.Form.Fields.Add(submitButton);
11+
//Create a Button field.
12+
PdfButtonField submitButton = new PdfButtonField(page, "Submit data");
2013

21-
// Create a submit action. It submit the data of the form fields to the mentioned URL.
22-
PdfSubmitAction submitAction = new PdfSubmitAction("http://www.syncfusionforms.com/Submit.aspx");
23-
submitAction.DataFormat = SubmitDataFormat.Html;
24-
submitButton.Actions.GotFocus = submitAction;
14+
//Set the properties to the button field.
15+
submitButton.Bounds = new RectangleF(100, 60, 50, 20);
16+
submitButton.ToolTip = "Submit";
17+
document.Form.Fields.Add(submitButton);
2518

26-
//Create file stream.
27-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
28-
{
29-
//Save the PDF document to file stream.
30-
document.Save(outputFileStream);
31-
}
19+
// Create a submit action. It submit the data of the form fields to the mentioned URL.
20+
PdfSubmitAction submitAction = new PdfSubmitAction("http://www.syncfusionforms.com/Submit.aspx");
21+
submitAction.DataFormat = SubmitDataFormat.Html;
22+
submitButton.Actions.GotFocus = submitAction;
3223

33-
//Close the document.
34-
document.Close(true);
24+
//Save the PDF document
25+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
26+
}
Lines changed: 19 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,25 @@
1-
// See https://aka.ms/new-console-template for more information
2-
3-
using Syncfusion.Pdf;
1+
using Syncfusion.Pdf;
42
using Syncfusion.Pdf.Interactive;
53

6-
//Create a new document.
7-
PdfDocument document = new PdfDocument();
8-
9-
//Add a page.
10-
PdfPage page = document.Pages.Add();
11-
12-
//Get stream from the sound file.
13-
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Startup.wav"), FileMode.Open, FileAccess.Read);
4+
//Create a new PDF document.
5+
using (PdfDocument document = new PdfDocument())
6+
{
7+
//Add a page.
8+
PdfPage page = document.Pages.Add();
149

15-
//Create a sound action.
16-
PdfSoundAction soundAction = new PdfSoundAction(fileStream);
17-
soundAction.Sound.Bits = 16;
18-
soundAction.Sound.Channels = PdfSoundChannels.Stereo;
19-
soundAction.Sound.Encoding = PdfSoundEncoding.Signed;
20-
soundAction.Volume = 0.9f;
10+
//Get stream from the sound file.
11+
FileStream fileStream = new FileStream(Path.GetFullPath(@"Data/Startup.wav"), FileMode.Open, FileAccess.Read);
2112

22-
//Set the sound action.
23-
document.Actions.AfterOpen = soundAction;
13+
//Create a sound action.
14+
PdfSoundAction soundAction = new PdfSoundAction(fileStream);
15+
soundAction.Sound.Bits = 16;
16+
soundAction.Sound.Channels = PdfSoundChannels.Stereo;
17+
soundAction.Sound.Encoding = PdfSoundEncoding.Signed;
18+
soundAction.Volume = 0.9f;
2419

25-
//Create file stream.
26-
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/Output.pdf"), FileMode.Create, FileAccess.ReadWrite))
27-
{
28-
//Save the PDF document to file stream.
29-
document.Save(outputFileStream);
30-
}
20+
//Set the sound action.
21+
document.Actions.AfterOpen = soundAction;
3122

32-
//Close the document.
33-
document.Close(true);
23+
//Save the PDF document
24+
document.Save(Path.GetFullPath(@"Output/Output.pdf"));
25+
}

0 commit comments

Comments
 (0)