Sign In  Sign Up Live-Chat

Font problem in PDF and Doc

Last post 08-25-2008, 9:53 AM by darkons. 22 replies.
Page 1 of 2 (23 items)   1 2 Next >
Sort Posts: Previous Next
  •  07-22-2008, 2:01 AM 136372

    Font problem in PDF and Doc

    Attachment: Present (inaccessible)
    Hi there,

    I have few questions regarding DOC-PDF conversion using Aspose:

    1. Attached are the same documents which I'm converting from DOC to PDF using Aspose.

    If you look at page number 5 onwards on the PDF version it seems there is formatting problem especially with Arial & Arial Narrow fonts, it doesn't produce the same result as expected in the DOC version.

    We have tried anything from retyping the whole paragraph and reapplying the fonts, to reapplying the style in MS-Word but it still doesn't giving same appearance as the DOC. If you can indicate what was the problem?

    This is how I save the PDF:

    doc.SaveOptions.PdfExportBookmarkLevel = 0;
    doc.SaveOptions.PdfExportFormFieldsAsText = false;
    doc.SaveOptions.ExportPrettyFormat = true;
    doc.SaveOptions.PdfExportMetafileResolution = 300;                       

    System.IO.MemoryStream mem = new System.IO.MemoryStream();
    doc.Save(mem, SaveFormat.AsposePdf);
    Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
    pdf.BindXML(mem, null);
    pdf.IsImagesInXmlDeleteNeeded = true;

    // Save PDF
    pdf.Save(filename);
    pdf.Close();


    mem.Close();

    2. Another question is:
    I read up in the forum that this flag "pdf.IsImagesInXmlDeleteNeeded = true;" will allow the temporary JPEG and PNG files in "windows\temp" folder to be deleted after PDF generation. Somehow it doesn't really do it's job, am I missing something here?

    Thank you
    Richard
     
  •  07-22-2008, 2:58 AM 136384 in reply to 136372

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hello Richard,

    Thanks for considering Aspose.

    I have tried converting the Word document into Pdf and have been able to generate it properly. I am using Aspose.Words 5.2.1.0  &  Apose.Pdf v3.7.0.0. I have also attached the output file, please take a review.

    Regarding your question for pdf.IsImagesInXmlDeleteNeeded = true, its used to delete the images in XML from the same folder where XML is being saved. In your code you are not saving the XML file, so it will not have any impact. For more information please visit IsImagesInXmlDeleteNeeded.

    For your information in order to embed the custom font in your Pdf file, use Pdf.setIsUnicode() before saving the Pdf file. For more information kindly visit Fonts embedding while creating Pdf


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
     
  •  07-24-2008, 9:34 PM 136857 in reply to 136384

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi,

    I've tried downloading the new version as you've suggested, and it works on Windows XP, but somehow on Windows 2k3 the problem still there, please see attached files.

    I've even try adding: pdf.SetUnicode(); as you've suggested but still nothing, Any idea?

    After playing around with the new DLL some more, actually it causes problemn with bullet points, if the bullet point style is "square" then it will disappear, however changed the DLL back to the old one and the bullet points are visible again.

    Thanks,

    Richard

     

     
  •  07-25-2008, 2:14 AM 136871 in reply to 136857

    Re: Font problem in PDF and Doc

    Hi Richard,

    I have tested this issue and I was able to reproduce the problem. The reason is that some fonts (like "Arial Narrow") are not installed as default in windows server 2003. You need to install the fonts by yourself to make it work well.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-29-2008, 12:10 AM 137272 in reply to 136871

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi,

    Actually "Arial Narrow" fonts are installed in the 2K3 machine, please see attached screenshot1.jpg

    But the weird thing is if you open up the pdf, some part of it already in Arial Narrow, but the rest is still substituted with just Arial.

    and another thing which makes this even more strange is that, if I open up the generated PDF and click on properties/fonts, it will be displayed list of all the fonts that are in used.

    It says Arial Narrow (Embedded Subset), while any other fonts doesn't have this description (please see attached screenshot2.jpg), what does it mean?

    Richard

     
  •  07-29-2008, 2:29 AM 137297 in reply to 137272

    Re: Font problem in PDF and Doc

    Hi Richard,

    To make this problem clear, please send your resulting PDF and tell me on detail where the problem is (or mark it in the PDF). If the Word doc is not the one in the previous post, please also provide the Word doc. Please also use Fontmap like the following:

       pdf.IsTruetypeFontMapCached = true;
       pdf.TruetypeFontMapPath = @"d:\test";

    and send the Aspose.Pdf.TruetypeFontMap.xml file to us. From that xml we can check the fonts installed in your system.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  07-29-2008, 11:05 PM 137448 in reply to 137297

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi Tommy,

    If you see on screenshot3.jpg, there are parts of the document that are in Arial Narrow, and in Arial, This is on page 5 of the pdf: UL-1-39-FTAWA-NIDNP-EE.pdf

    I've added the code as you've suggested, so my code become like this

    doc.SaveOptions.PdfExportBookmarkLevel = 0;
    doc.SaveOptions.PdfExportFormFieldsAsText = false;
    doc.SaveOptions.ExportPrettyFormat = true;
    doc.SaveOptions.PdfExportMetafileResolution = iDPI;  

    System.IO.MemoryStream mem = new System.IO.MemoryStream();
    doc.Save(mem, SaveFormat.AsposePdf);
    Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();
    pdf.BindXML(mem, null);

    // Save PDF
    pdf.IsTruetypeFontMapCached = true;
    pdf.TruetypeFontMapPath = @"c:\test";
    pdf.SetUnicode();
    pdf.Save(filename);
    pdf.Close();

    However I could not find Aspose.Pdf.TruetypeFontMap.xml in c:\test or anywhere, how do I get this xml file?

    Thanks,

    Richard

     
  •  07-30-2008, 6:25 AM 137505 in reply to 137448

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi Richard,

     

    I have tested the code that you have shared, and I am able to generate the “Aspose.Pdf.TruetypeFontMap.xml” file at c:\test.  I am not sure why you are facing the problem. Please try our latest version of Aspose.Pdf v3.7.0.5 to resolve this issue. The file is in attachment. Incase the problem still persists, please feel free to share.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
     
  •  07-30-2008, 8:34 AM 137526 in reply to 137505

    Re: Font problem in PDF and Doc

    Hi Richard,

    It is really strange that one text paragraph works well but the other does not. Which version of Aspose.Words are you using? Can you please modify your code to save the XML onto disk and attach it here?


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  08-03-2008, 9:17 PM 138138 in reply to 137526

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi Tommy and Nayyer,

    1. I've managed to produce the XML files and the font map xml, please see attached zip files, however the problem still there. Below are the scenarios which this problem occured:

    XP
    Aspose.PDF 3.6.2.3
    Aspose Word 5.1.0.0
    Result => Good (After install 3.7.0.0 and 5.2.1.0 and then rolled back)

    2K3
    Aspose.PDF 3.6.2.3
    Aspose Word 5.1.0.0
    Result => Not good

    XP
    Aspose.PDF 3.7.0.0 or 3.7.0.5
    Aspose Word 5.2.1.0
    Result => Good

    2K3
    Aspose.PDF 3.7.0.0 or 3.7.0.5
    Aspose Word 5.2.1.0
    Result => Not Good

    2. I have another problem, when the original word document has a "square" bullet point and needs to be converted to PDF, the square bullet point will be missing from the output PDF, please see attached "testbullet.pdf", this only occur with new version 3.7.0.0 and 5.2.1.0, old version works fine.

    Thank you very much

    Richard
     

     
  •  08-04-2008, 6:56 AM 138207 in reply to 138138

    Re: Font problem in PDF and Doc

    Hi Rechard,

    If you compare the following two parts of the XML you can find the only difference is the IsUnicode setting.

          <Segment IsUnicode="true" FontName="Arial Narrow" FontSize="10">The employer’s declaration applies to the undertakings to vary the Australian workplace agreement for each employee identified in the undertaking. </Segment>

          <Segment FontName="Arial Narrow" FontSize="10">The employer makes this declaration and gives the undertaking under caution that the provision of any information or document to the Workplace Authority the employer knows to be false or misleading is a serious offence under the </Segment>

    It seems the font does not work well if it is not set to unicode. As a workaround, please add the following code before Save PDF:

       pdf.SetUnicode();

    I think this can resolve your problem.

    As for the bullet problem, please provide the Word document and let us check it.


    Tommy Wang
    Lead Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  08-04-2008, 10:07 PM 138283 in reply to 138207

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi Tommy,

    1. I think I've already put the code snippet in my previous post, and it already has pdf.SetUnicode(); and the problem still there.

    doc.SaveOptions.PdfExportBookmarkLevel = 0;
    doc.SaveOptions.PdfExportFormFieldsAsText = false;
    doc.SaveOptions.ExportPrettyFormat = true;
    doc.SaveOptions.PdfExportMetafileResolution = iDPI;

    System.IO.MemoryStream mem = new System.IO.MemoryStream();
    doc.Save(mem, SaveFormat.AsposePdf);
    Aspose.Pdf.Pdf pdf = new Aspose.Pdf.Pdf();

    pdf.BindXML(mem, null);
    pdf.SetUnicode();
    pdf.Save(filename);
    pdf.Close();

    mem.Close();

    2. Regarding the bullet points please see my attached testbullet.doc and testbullet.pdf, they are the same document converted to PDF, notice that the bullet points gone after the conversion.

    Richard

     
  •  08-05-2008, 1:18 AM 138306 in reply to 138283

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hello Richard,

     

    We apologize for the inconvenience that you have experienced in this regard. Our development team is looking into the font related issue and soon you will be updated with the resolution status.

    Concerning to bullets related issue, I have tried converting the Word document using Aspose.Words 5.2.1 & latest hotfix of Aspose.Pdf v3.7.0.5 and in my case, the bullets were not removed in the  resultant pdf, and I am unable to reproduce the problem. Beside this, there are few formatting issues in the resultant Pdf and we are investigating to get them resolved.

     

    I have attached the resultant Pdf and latest hotfix, please take a review, and incase of any concerned issues, feel free to share.


    Nayyer Shahbaz
    Support Developer
    Aspose Changsha Team
    About Us
     
  •  08-05-2008, 4:31 PM 138460 in reply to 138306

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)
    Hi Richard,

    I have attached our latest dll and a xml file which helps us find the solution. Would you please convert the xml into pdf and let us know the results? Using codes as follow:
                pdf.BindXML(@"F:/temp/temp.xml", null);
                //pdf.SetUnicode();          
                pdf.Save(@"F:/temp/test.pdf");
    Please test it two times(one set pdf.SetUnicode() and another don't) in windows 2003 and send us the resulted pdfs.
    Thanks.

    Best regards.

    Hans Zhang
    Product Developer
    Aspose Changsha Team
    About Us
    Contact Us
     
  •  08-07-2008, 2:32 AM 138682 in reply to 138460

    Re: Font problem in PDF and Doc

    Attachment: Present (inaccessible)

    Hi,

    Attached are the resulted pdfs, please tell me if you find out anything.

    Thanks,

    Richard

     
Page 1 of 2 (23 items)   1 2 Next >
View as RSS news feed in XML