Free Support Forum - aspose.com

Error in Word to PDF to image conversions

Hello!

We are using font Republika in our Word documents. These Words documents are converted to PDF with Document.Save method from Aspose.Words. We are also using gsview application to convert created PDF documents to images. Until version 9.7 of Aspose.Words it all worked fine. But from version 9.8 (including the latest 10.3 version) we get an exception when converting PDF to image. It seems like the font Republika is not included in PDF anymore.

I attached the original Word document and PDF documents which were created from it using Aspose.Words 9.7, Aspose.Words 9.8 and Aspose.Words 10.3.

Here is the error message we get when converting PDF to image:

System.Exception: command: C:\GSSV\ThumbnailGeneratorService…\external\ThumbnailGeneratorLibraries\gs\gs8.71\bin\gswin32c.exe
arguments: -q -dNOPAUSE -sDEVICE=jpeg -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sOutputFile=“C:\GSSV\ThumbnailGeneratorService…\temp_thumbnails\1847\thumb\tmp_page.%d.thumb.jpg” “C:\GSSV\ThumbnailGeneratorService…\temp_thumbnails\1847\1847.pdf” -c quit
exit code 1
STDOUT:

Error: /undefinedresource in findresource
Operand stack:
–dict:6/15(L)-- FAAABC 12 --dict:6/6(L)-- --dict:6/6(L)-- FAAABC+Republika-Bold --dict:10/12(ro)(G)-- --nostringval-- CIDFontObject --dict:8/8(L)-- --dict:8/8(L)-- FAAABC+Republika-Bold CIDFont FAAABC+Republika-Bold
Execution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push 1878 1 3 %oparray_pop 1877 1 3 %oparray_pop 1861 1 3 %oparray_pop --nostringval-- --nostringval-- 2 1 1 --nostringval-- %for_pos_int_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- false 1 %stopped_push --nostringval-- %loop_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- --nostringval-- %array_continue --nostringval-- --nostringval-- --nostringval-- --nostringval-- 1829 13 10 %oparray_pop findresource %errorexec_pop --nostringval-- --nostringval-- --nostringval–
Dictionary stack:
–dict:1159/1684(ro)(G)-- --dict:1/20(G)-- --dict:75/200(L)-- --dict:75/200(L)-- --dict:108/127(ro)(G)-- --dict:288/300(ro)(G)-- --dict:22/25(L)-- --dict:6/8(L)-- --dict:21/40(L)-- --dict:9/15(L)-- --dict:20/26(ro)(G)–
Current allocation mode is local
Last OS error: No such file or directory

STDERR:

GPL Ghostscript 8.71: Unrecoverable error, exit code 1



What has changed in the Save method? How can I solve this?

Regards,
Dejan

Hello

Thanks for your request. Could you please attach "Republika" font here for testing? I will check the problem on my side and provide you more information.

Best regards,

Hi!

Fonts are attached.

Regards,
Dejan

Hello

Thank you for additional information. During converting document to PDF Aspose.Words reads font files and creates subsets of fonts, which are used in PDF. As I can see all needed subsets of fonts are embedded into the PDF. Please see the attached screenshot. Maybe the problem occurs with gsview.

Also you can try using Aspose.Words to convert your document to Image.

Document doc = new Document(@"C:\\Temp\\\RepublikaFontTesting.doc");

doc.Save("C:\\Temp\\out.jpg", SaveFormat.Jpeg);

Best regards,

Hello

Also in my PDF files you can see, that Republika font (Type1) is embedded. If you check the font properties in PDF files created with different Aspose versions they all look the same. But obviously something changed in the phase of creating PDF from Word document because in previous versions gsview successfully converted PDF files and now it doesn’t.

I’m aware, that maybe gsview is not the best choice for converting files to images and probably we will replace it. I was just hoping you can give me an idea for a quick fix .

Hello

Thank you for additional information. It is quite strange. The PDF generated by Aspose.Words is valid PDF document.

Maybe in your case you can try using Aspose.Pdf.Kit to convert your document to Image.

Best regards,