I want to convert doc/docx to pdf, and then convert it to thumbnail. But all chinese characters in original doc file change to trash code after convert it to pdf, how to solve this problem? The product I used is 'aspose.word aspose.pdf.kit aspose.pdf ’
In addition, is there any way to set the size, width and height of the thumnail?
The samp code is:
Document doc = new Document(@"C:\Documents and Settings\Administrator\Desktop\MyDocument.doc");
doc.Save(@"C:\Documents and Settings\Administrator\Desktop\MyDocument.xml", SaveFormat.AsposePdf);
Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
pdf.BindXML(@"C:\Documents and Settings\Administrator\Desktop\MyDocument.xml", null);
pdf.IsImagesInXmlDeleteNeeded = true;
pdf.Save(@"C:\Documents and Settings\Administrator\Desktop\MyDocument.pdf");
// Convert Each page of a pdf Document to a image.
PdfConverter converter = new PdfConverter();
converter.BindPdf(@"C:\Documents and Settings\Administrator\Desktop\MyDocument.pdf");
converter.DoConvert();
String prefix = @"C:\Documents and Settings\Administrator\Desktop\";
String suffix = ".jpg";
int imageCount = 1;
while (converter.HasNextImage())
{
if (imageCount == 5)
break;
converter.GetNextImage(prefix + imageCount + suffix, ImageFormat.Jpeg);
imageCount++;
}
Hello!
Thank you for your inquiry.
I have reproduced the issue. It requires cooperation with Aspose.Pdf team to be solved. I cannot promise to help you fast. Asian languages support has many limitations in our products. Let’s wait what Aspose.Pdf team answers. I’ll keep you informed of any progress.
To set width and height of a thumbnail you can try another overload of GetNextImage(): https://docs.aspose.com/pdf/net/converting/
Regards,
Thanks for your help!
I used GetNextImage(Stream outputStream, ImageFormat format, int resolutionX, int resolutionY, int quality) function to convert pdf to thumbnail but created jpg image’s width and height not i wanted. what wrong wiht it?
I am a developer of Aspose.Pdf. I have tried to convert your doc into pdf. I found the xml is not correctly generated. I think this should be a bug in Aspose.Words. Thanks.
Hello!
Thank you for your expertise. I have logged the problem with encoding as #4597 in our defect database. We’ll investigate it and provide more information on any progress.
As a workaround you can try re-saving this file again as RTF in MS Word. It helped me to created well-formed Aspose.Pdf XML containing proper Unicode characters but I’m unable to check whether it converts to PDF correctly without having Asian languages support. I asked Aspose.Pdf team leader about this. Since you are working with documents containing hieroglyphs you should get proper conversion result after the rtf2rtf roundtrip.
Regards,