Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!
PDF Font Display Issue |
Post Reply |
Author | |
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
Posted: 11 Feb 19 at 12:40AM |
I have a PDF file that uses MSLineDraw (Embedded Subset) font to show lines and borders.
For this file, if I write a text using DrawText, all the borders drawing are getting messed up and after writing, it shows only the Helvetica font in the Document properties Font List. Also I noticed this issue happens not just with DrawText and even if I use SetTextSize (without writing anything using that size), this issue happens. I have already tried NormalizePage, TransformFile, CombineContentStreams etc without much luck.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi ysr, few things to keep in mind... QuickPDF works with unicode. Fonts used before and after have to be the same to get comparable results. If you need an external font inside the library you have to add it (AddTrueTypeFont). Regarding lines we have DrawLine in the library: https://www.debenu.com/docs/pdf_library_reference/DrawLine.php HTH Ingo |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Hi Ingo,
Thank you very much for your reply. The existing font is MSLineDraw and the Encoding is shown as "Built In" (When I view the font details via Adobe properties screen). I am not trying to draw any line. On this file, even if I just call SetTextSize(12) and save the file, all the previous fonts are getting removed, only Helvetica font is added and the contents get messed up.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Regarding the issue "fonts" you should read in the developer guide at chapter 4.15 and further.
http://www.debenu.com/docs/pdf_library_developer_guide/foxit_quick_pdf_library_15_developer_guide.pdf The library supports only some standard fonts. In the developer guide you'll find these fonts. If you need additionally fonts for a matching layout you have to add these fonts as font files. If you have an external pdf file and want to know if there's a font file inside (not referenced) then you can use function "HasFontResources". If we should check your pdf document for similar results with our routines you should upload the pdf anywhere posting the link here. |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Hi Ingo,
The sample file is available at http://203.89.208.176/samplefile.pdf For this, If I do a draw text the file gets messed up. I do not think it is the way I am using drawtext or adding fonts, as it works with every other file.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi, i did the download and will check it within few days. Perhaps another one here will do the same. The problem will be the used font i think... |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Thank you very much Ingo. Really appreciate the support especially on a community forum.
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi Yoganathan,
what i've done so far... I've checked your file with my PDF-Analyzer. There is one font referenced: CourierNew. There is one font embedded: MSLineDraw. Then i've added a page number at the bottom, on the right side "page 1 from 1". I didn't select a font doing this. QuickPDF took "Times Bold" - Now i've a second font referenced in the pdf. My rendered preview wasn't messed up - it still looks well layouted. What you should do before drawing text into a new (for you new) pdf document: 1. Using CombineContentStreams: https://www.debenu.com/docs/pdf_library_reference/CombineContentStreams.php 2. Using NormalizePage: https://www.debenu.com/docs/pdf_library_reference/NormalizePage.php Then you shouldn't have problems like described here. |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Hi Ingo,
Thank you very much for that. I did use both of those functions and also tried various others such as BalanceContentSTreams etc without much luck. I assume I may not be using them in the right order or with right parameters. Would it be possible to share the sample code that worked for you?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Hi,
mmmmh... here it is but i fear this won't help you much. // . . . QP := TDebenuPDFLibrary1611.Create; try Save_Cursor := Screen.Cursor; Screen.Cursor := crHourglass; // Show hourglass cursor QP.LoadFromFile(Edit1.text, ''); QP.SetTempPath(tpath); If QP.EncryptionStatus > 0 Then QP.Decrypt; //-- if rb5 checked = true ... new page numbering at the bottom if rb5.Checked = True Then begin QP.SetOrigin(1); QP.SetMeasurementUnits(0); // . . . sfont := QP.AddStandardFont(10); // . . . QP.SelectFont(sfont); // . . . If ( Trim(combocolor.Text) = 'red' ) or ( Trim(combocolor.Text) = 'rot' ) Then QP.SetTextColor(1,0,0); // . . . for i := 1 to QP.PageCount do begin // . . . QP.SelectPage(i); // . . . QP.SetTextSize(StrToInt(snrufg.Text)); // . . . QP.DrawText(StrToInt(snrpos.Text), QP.PageHeight - ( 3 + StrToInt(snrufg.Text) ), gtxt); end; QP.SetMeasurementUnits(0); end; //------------------------------------------- finally // . . . |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Thanks Ingo
A couple of questions though 1) On this code you are not using NormalizePage or CombineContent streams. Did it work without those? 2) How do you save the file at the end? I use SaveToFile to overwrite the same file.
Edited by ysr - 14 Feb 19 at 8:45PM |
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
Normalize and combine are at another place more at the top ...
I'm using the normal Save from QuickPDF. Yes. It CAN work without Normalize and Combine... but not for all files. If there's a file with rotate nnn included then it won't work proper without Normalize... Edited by Ingo - 14 Feb 19 at 9:23PM |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Shouldn't the CombineContentstreams need to be done after loading the file and NormalizePage for each file rather than at the top?
|
|
Ingo
Moderator Group Joined: 29 Oct 05 Status: Offline Points: 3524 |
Post Options
Thanks(0)
|
I MEAN AFTER LOAD!
With "at the top" i mean not in the code range i've copied but before. Please read the online reference, the online samples, the developer guide, ... |
|
Cheers,
Ingo |
|
ysr
Beginner Joined: 02 Aug 18 Location: Melbourne Status: Offline Points: 14 |
Post Options
Thanks(0)
|
Just for the benefit of others who may have similar issue, with the help of Debenu (Foxit) support team we found:
1) The file had the page media box and page resources defined outside of page object 2) By calling BalancePageTree(0) once the file is loaded, we managed to fix the issue.
|
|
Post Reply | |
Tweet
|
Forum Jump | Forum Permissions You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |
Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. About — Contact — Blog — Support — Online Store