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!
![]() |
Font has not been embedded in pdf |
Post Reply ![]() |
Author | |
timur ![]() Beginner ![]() Joined: 23 Jul 21 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() Posted: 23 Jul 21 at 1:30PM |
Hi everyone, PDFs Created QPDFLibrary with Version 15 Platform: Windows Server 2019 Programming Language: C# (Net Framework 4.72) I get following message from Acrobat Reader, but not always. GWQGUD changing every time. In some of my created pdfs missing the obj definition for that (I open it Notepad++) What can be the cause of missing obj definition. How can I debug it, or how can i check whether obj definition has been added successfully before or after creating pdf?
Thanks in advance KR Timur |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Timur,
did you embed the font? If not i think that the error occurs on systems, where this font isn't installed. Try AddTrueTypeFontFromFile: https://www.debenu.com/docs/pdf_library_reference/AddTrueTypeFontFromFile.php Cheers and welcome here, Ingo |
|
Cheers,
Ingo |
|
![]() |
|
timur ![]() Beginner ![]() Joined: 23 Jul 21 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hi Ingo,
thank you for response. Yes I embed it as subset (DebenuPDFLibraryAddTrueTypeSubsettedFont). Same code , I see in PDF "Times New Roman(Embedded Subset)" and it working. but sometimes i see just "Times New Roman" without anything (In PDF Options). And if I try to open it in Adobe I get the Error. It is a mystery for me. I add every time a font for creating font with DebenuPDFLibraryAddTrueTypeSubsettedFont. I thought if I remove the document from Instance (DebenuPDFLibraryRemoveDocument) fonts will be removed as well. Is not the case, how can I clear the fonts I have already added? I get the error on PDF Exchange Editor: error loading object misaligned object Edited by timur - 27 Jul 21 at 10:35AM |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
Hi Timur,
perhaps it's better to post the relevant code parts? QuickPDF uses unicode strings. What option (0-5) did you use? |
|
Cheers,
Ingo |
|
![]() |
|
timur ![]() Beginner ![]() Joined: 23 Jul 21 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hii Ingo,
thanks again.
Option Its a windows service. At first I created the Library on Startup and removed (RemoveDocument) the document. But now on every request I create the library again an still I want to mention it it happens only on Windows Server 2019 (or we have not detect anywhere else). And my Console app for testing working without problem on the same Server. Hier is Example Class: public class TestClass { public TestClass() { // as I mentioned it I created at first only once here. } public void StampIt() { var pdfLibrary = new PDFLibrary("pdfLibraryPath"); pdfLibrary.UnlockKey("myKey"); var file = "Test.pdf"; pdfLibrary.SetTransparency(0); pdfLibrary.SetLineWidth(1); pdfLibrary.SelectPage(1); pdfLibrary.SetOrigin(1); pdfLibrary.NormalizePage(0); pdfLibrary.LoadFromString(ConvertDocument(file).ToArray(), string.Empty); var fontId = pdfLibrary.AddTrueTypeSubsettedFont("Times New Roman [Bold]", string.Empty, 4); pdfLibrary.SetTextAlign(1); pdfLibrary.SetTextColor(0.0, 0.0, 0.0); pdfLibrary.SetTextSize(19); pdfLibrary.SelectFont(fontId); pdfLibrary.DrawRotatedMultiLineText(121.60, 212.68, 0, "\n", "Test Test Test\n22.07.2021"); pdfLibrary.SaveToFile(Path.GetFileNameWithoutExtension(file) + "_stamped" + Path.GetExtension(file)); } public static MemoryStream ConvertDocument(string path) { var pdfFileStream = new MemoryStream(); using (var fileStream = new FileStream(path, FileMode.Open, FileAccess.Read)) { fileStream.CopyTo(pdfFileStream); } return pdfFileStream; } } and some log:Font Id: 1476395020 Font count: 1 Is Subsetted: 1 Font type: 10 Font encoding: 5 Selected font: 1476395020 Stamp Text TEST TEST TEST thanks in advance KR Timur Edited by timur - 02 Aug 21 at 12:51PM |
|
![]() |
|
timur ![]() Beginner ![]() Joined: 23 Jul 21 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Hi Ingo,
is it possible to use a system font to avoid the embedding failures? Which font can I use (Courier New?) and how to select it for my pdf without embedding it. Thanks in advance KR
Timur |
|
![]() |
|
Ingo ![]() Moderator Group ![]() ![]() Joined: 29 Oct 05 Status: Offline Points: 3529 |
![]() ![]() ![]() ![]() ![]() |
If these syntax shall work:
// ... pdfLibrary.SetTransparency(0); pdfLibrary.SetLineWidth(1); pdfLibrary.SelectPage(1); pdfLibrary.SetOrigin(1); pdfLibrary.NormalizePage(0); //... you should post it after LoadFromString. Here you'll find all font-related functions: http://www.quickpdflibrary.com/help/quickpdf/Fonts.php A kb-sample about how to draw text onto a pdf: https://www.debenu.com/kb/generate-invoice-programmatically-pdf/ In the kb-sample any actual font is used. To select one of the standard fonts try these steps before Drawing functions: With FindFonts you can get the number of embedded fonts. In a loop now you can go through all found fonts with FontID -> SelectFont (with FontID) -> FontName. If the fontname is the one you want you can break the loop (SelectFont is already done) beginning with the DrawText-functions. These are the standard fonts: https://www.debenu.com/docs/pdf_library_reference/SetFormFieldStandardFont.php Edited by Ingo - 02 Aug 21 at 8:32PM |
|
Cheers,
Ingo |
|
![]() |
|
timur ![]() Beginner ![]() Joined: 23 Jul 21 Status: Offline Points: 6 |
![]() ![]() ![]() ![]() ![]() |
Thanks a lot
|
|
![]() |
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