We're currently performing a trial of the Aspose Words SDK for .NET and we're running into issues with a component we use to display PDF content inline in Silverlight applications. We use a Word template to run a merge on the client's data and save the result as a PDF which they can then view inline. Apparently this PDF viewer is unable to display images that have been used as a fill for a rectangle in fact all we get is a black rectangle. Interestingly enough images that come from the merge itself (using a FieldMergingCallback and a MemoryStream) do display appropriately in the viewer it's just the images that come from the Word document itself that have this issue.
My guess then is that the image is being embedded when going through a merge and it's a fill on a rectangle when straight from the Word document. I've looked through the forums and documentation and so far have come up blank on a solution. My question then would be can we somehow change the way images are added to the PDF when coming straight from the Word document?
Hi Kris,
Thanks for your inquiry. Could you please attach your input template document, you're getting problems during rendering to PDF, here for testing? I will investigate the issue on my side and provide you more information.
Best Regards,
Good morning,
I've attached a zip file that contains a simple word document with an embedded image and a merge field that merges an image in. I've included the embedded image as well so you can use the same image during merging. When this file is converted to a PDF and rendered in our 3rd party viewer the top image, that is the embedded one, shows up as a black rectangle and the bottom merged image shows up fine; in Acrobat they both show up fine of course. I've been told by the vendor that it's because the top image is a fill on a rectangle which they don't support. I'm not sure if that's actually what is going on but it seems as though the way the two images are rendered into the PDF are different based on whether it's embedded in the document or merged in. Hopefully there's some way we can control this in the SDK so that we can get the embedded images out in a format that our viewer supports.
Let me know if you need anything else.
Hi Kris,
Thanks for the additional information.
First of all, please note that Aspose.Words page layout engine tries to mimic the way the Microsoft Word’s page layout engine works. To you, this means that if you convert a Microsoft Word document into PDF, XPS or print it using Aspose.Words, the output will appear almost exactly as if it was done by Microsoft Word.
Secondly, I have attached a PDF document (out.pdf), i.e. generated by using Aspose.Words v11.4.0 on my side, here for your reference. Please let us know how it goes with your 3rd party PDF viewer?
Best Regards,
Good morning,
I ran the PDF you provided through the viewer and unfortunately it exhibits the same issue. The top image is a black rectangle and the bottom image displays properly. I'm curious as to what the difference between the two images is in the PDF file?
The PDF of course renders fine in Acrobat.
Kris.
Hi Kris,
Thanks for the additional information. I tried viewing the ‘out.pdf’ document, i.e. attached with my previous post, with different viewers e.g. Foxit Reader on my side; but, was unable to reproduce this issue. Both of these images were displayed correctly. Could you please tell us about the PDF Viewer you’re using to display PDF files with? If we have this information, it would be helpful in further investigation.
Best Regards,
You bet. We're using Telerik's Silverlight PDF viewer so that we can embed PDF previews in our application. If you want to quickly confirm the issue you can go to http://demos.telerik.com/silverlight/#PdfViewer/FirstLook and click on the open button on the PDF viewer's toolbar and pass in the output document. As I was told by the developer's there it seems to be that the top image is using some sort of image fill and the bottom image is an embedded image.
Let me know if you need anything else.
Kris.
Hi Kris,
Thanks for the additional information. Yes, you’re right; I managed to reproduce this issue on my side. I have logged this potential issue in our bug tracking system. The issue ID is WORDSNET-6481. Your request has also been linked to this issue and you will be notified as soon as it is resolved. Sorry for the inconvenience.
Best Regards,
Awesome, sounds good. Thanks for your assistance with this issue.
Kris.
Hello, Kris.
The issue you described is not a bug of Aspose.Words.
Analysis shows that problem pictures are DrawingML paths filled with
images. Such objects are rendered as paths with texture brush and is stored in PDF as patterns. It seems that 3rd party viewer doesn’t support PDF patterns properly, though they are described in
PDF specs.
Unfortunately there’s no easy (acceptable) way to change the rendering pipeline in this matter and to save such paths like MS Word does (it uses some special conversions). We don’t plan such changes in the foreseeable future.
Best regards,
The issues you have found earlier (filed as WORDSNET-6481) have been fixed in this .NET update and this Java update.
This message was posted using Notification2Forum from Downloads module by aspose.notifier.