Skip to content

Commit e3c3ae4

Browse files
Added sample for KB how to Ensure Annotations and Form Fields Are Visible in Copied PDF Documents in PdfViewer?
1 parent f792545 commit e3c3ae4

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed
452 KB
Binary file not shown.

Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
Title="MainWindow" Height="450" Width="800">
99
<Grid>
1010
<PdfViewer:PdfViewerControl Name="PDFViewer"/>
11+
<Button Content="Button" HorizontalAlignment="Left" Margin="56,10,0,0" VerticalAlignment="Top" Click="Button_Click"/>
1112
</Grid>
1213
</Window>

Create_NewPDF_From_Exsisting_document_pages/MainWindow.xaml.cs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,18 @@ public MainWindow()
2424
{
2525
InitializeComponent();
2626

27+
PDFViewer.Load(filePath + "Input.pdf");
28+
}
29+
30+
private void Button_Click(object sender, RoutedEventArgs e)
31+
{
2732
//Load a PDF document
28-
PdfLoadedDocument ldoc = new PdfLoadedDocument(filePath + "Input.pdf");
33+
PdfLoadedDocument ldoc = new PdfLoadedDocument(filePath + "Input.pdf");
2934

3035
ldoc.FlattenAnnotations();
3136

32-
if(ldoc.Form != null && ldoc.Form.Fields.Count > 0)
33-
ldoc.Form.FlattenFields();
37+
if (ldoc.Form != null && ldoc.Form.Fields.Count > 0)
38+
ldoc.Form.FlattenFields();
3439

3540
//Create a new instance of PdfDocument class
3641
PdfDocument document = new PdfDocument();
@@ -56,7 +61,7 @@ public MainWindow()
5661
g.DrawPdfTemplate(template, new PointF(0, 0), new SizeF(page.GetClientSize().Width, page.GetClientSize().Height));
5762

5863
}
59-
document.Save( filePath + "Output.pdf");
64+
document.Save(filePath + "Output.pdf");
6065
PDFViewer.Load(filePath + "Output.pdf");
6166
}
6267
}

0 commit comments

Comments
 (0)