Exporting PDF as image with annotations
Hi,
using this document (https://help.syncfusion.com/wpf/pdf-viewer/exporting-pdf) I'm able to export PDF page as image, but without annotations. Is it also possible to export it with annotations?
Thanks
Ondra
SIGN IN To post a reply.
12 Replies
1 reply marked as answer
DD
Divya Dhayalan
Syncfusion Team
January 27, 2021 02:56 PM UTC
Hi Ondrej,
Thanks for contacting Syncfusion support.
Yes, we can export image with annotation. We have created a sample to export images with annotation, which we added using PdfViewerControl. Please download the sample form the below link.
We have created a video for your reference, please download the video from the below link:
Please let us know if the provided details helps to achive your requirement or if you need any further assistance on this.
Regards,
Divya
Marked as answer
OS
Ondrej Svoboda
January 28, 2021 10:18 AM UTC
Hi, thanks this works.
I've found out that the problem was that I was using different ExportAsImage function: pdfviewercontrol.LoadedDocument.ExportAsImage(); and this one doesn't save the annotations.
OS
Ondrej Svoboda
January 28, 2021 12:15 PM UTC
Hi,
Attachment: files_9899146c.zip
I've found strange behavior of your sample, probably a bug.
I'm exporting only the first page, with this code change:
//BitmapSource[] image = pdfviewercontrol.ExportAsImage(0, pdfviewercontrol.LoadedDocument.Pages.Count - 1);
BitmapSource[] image = new[] { pdfviewercontrol.ExportAsImage(0) };
Follow these steps:
- Run the sample
- Add textbox annotation
- Click ExportToImage button
In the resulting image you'll see the text box twice. See attached file - image and also edited pdf. If you open this pdf and just export to image, you'll see again two text boxes. In the preview it is OK - only once.
Strange part is when you change the export method to this:
BitmapSource[] image = pdfviewercontrol.ExportAsImage(0, 0);
all works fine again. So I think the problem is only in ExportAsImage method with one parameter.
Have a look on it please.
Attachment: files_9899146c.zip
DD
Divya Dhayalan
Syncfusion Team
January 29, 2021 02:48 PM UTC
Hi Ondrej,
Please find the details below.
|
I've found strange behavior of your sample, probably a bug.
I'm exporting only the first page, with this code change:
//BitmapSource[] image = pdfviewercontrol.ExportAsImage(0, pdfviewercontrol.LoadedDocument.Pages.Count - 1);
BitmapSource[] image = new[] { pdfviewercontrol.ExportAsImage(0) }; Follow these steps:
Run the sample
Add textbox annotation
Click ExportToImage button
In the resulting image you'll see the text box twice. See attached file - image and also edited pdf. If you open this pdf and just export to image, you'll see again two text boxes. In the preview it is OK - only once.
Strange part is when you change the export method to this:
BitmapSource[] image = pdfviewercontrol.ExportAsImage(0, 0);
all works fine again. So I think the problem is only in ExportAsImage method with one parameter.
|
On analyzed further, we found the reported issue “ExportAsImage with single parameter resultant image have improper count of text annotation” is a defect and we have logged a defect report for this. The patch for this fix is expected to be available on February 12th, 2021.
Please find the feedback link below
|
Regards,
Divya
OS
Ondrej Svoboda
February 1, 2021 09:13 AM UTC
Hi,
thanks, but I can't open the feedback link. I'm getting this error:
Access Denied
This private feedback is not associated with your account.
DD
Divya Dhayalan
Syncfusion Team
February 2, 2021 10:23 AM UTC
Hi Ondrej,
Sorry for the inconvenience caused.
We have now changed the visibility of the feedback to public. Please try again and let us know if works.
Regards,
Divya
DD
Divya Dhayalan
Syncfusion Team
February 13, 2021 09:23 AM UTC
The issue “ExportAsImage with single parameter resultant image have improper count of text annotation” has been fixed and patch for this fix can be downloaded from the following location.
Recommended approach - exe will perform automatic configuration
Please find the patch setup from below location: https://syncfusion.com/Installs/support/patch/18.4.0.30/359738/I161889/SyncfusionPatch_18.4.0.30_359738_2122021113159214_I161889.exe
Advanced approach – use only if you have specific needs and can directly replace existing assemblies for your build environment
Please find the patch assemblies alone from below location:
Assembly Version: 18.4.0.30
Installation Directions:
This patch should replace the files “Syncfusion.Pdf.Base.dll, Syncfusion.PdfViewer.WPF.dll” under the following folder.
$system drive:\ Files\Syncfusion\Essential Studio\$Version # \precompiledassemblies\$Version#\4.6
Eg : $system drive:\Program Files\Syncfusion\Essential Studio\9.3.0.61\precompiledassemblies\9.3.0.61\4.0
To automatically run the Assembly Manager, please check the Run assembly manager checkbox option while installing the patch. If this option is unchecked, the patch will replace the assemblies in precompiled assemblies’ folder only. Then, you will have to manually copy and paste them to the preferred location or you will have to run the Syncfusion Assembly Manager application (available from the Syncfusion Dashboard, installed as a shortcut in the Application menu) to re-install assemblies.
Note:
You can change how you receive bug fixes by navigating to the following link and updating your preferences.
This fix will be included in our 2021 Volume 1 release which will be available on March month – 2021
Please find the feedback link below,
Regards,
Divya
OS
Ondrej Svoboda
February 25, 2021 03:30 PM UTC
Hi,
was this already released in nuget weekly release 18.4.0.44?
DD
Divya Dhayalan
Syncfusion Team
February 26, 2021 09:35 AM UTC
Hi Ondrej,
No, this fix was not included in the weekly NuGet release version 18.4.0.44, We will include the fix in our next weekly NuGet release which is expected to be available on 2nd March 2021.
Regards,
Divya
VS
Vikas Sekar
Syncfusion Team
March 2, 2021 01:02 PM UTC
Hi Ondrej,
As we mentioned in the previous update, we have included the fix for this issue “ExportAsImage with single parameter resultant image have improper count of text annotation” in our latest weekly NuGet release, so kindly upgrade to latest version v18.4.0.46 to get the issue resolved.
Regards,
Vikas
OS
Ondrej Svoboda
March 5, 2021 01:48 PM UTC
Thanks, I can confirm that it is fixed now.
DD
Divya Dhayalan
Syncfusion Team
March 8, 2021 05:28 AM UTC
Most Welcome.
Please let us know if you need any further assistance on this.
Regards,
Divya
SIGN IN To post a reply.
- 12 Replies
- 3 Participants
- Marked answer
-
OS Ondrej Svoboda
- Jan 26, 2021 03:02 PM UTC
- Mar 8, 2021 05:28 AM UTC