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!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > I need help - I can help
  New Posts New Posts RSS Feed - Font has not been embedded in pdf
  FAQ FAQ  Forum Search   Register Register  Login Login

Font has not been embedded in pdf

 Post Reply Post Reply
Author
Message
timur View Drop Down
Beginner
Beginner


Joined: 23 Jul 21
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote timur Quote  Post ReplyReply Direct Link To This Post Topic: Font has not been embedded in pdf
    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.

"Cannot find or create the font "GWQGUD+Times New Roman". Some charachters may not display or print correctly."
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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 26 Jul 21 at 10:02PM
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

Back to Top
timur View Drop Down
Beginner
Beginner


Joined: 23 Jul 21
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote timur Quote  Post ReplyReply Direct Link To This Post Posted: 27 Jul 21 at 7:31AM
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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 31 Jul 21 at 3:24PM
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

Back to Top
timur View Drop Down
Beginner
Beginner


Joined: 23 Jul 21
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote timur Quote  Post ReplyReply Direct Link To This Post Posted: 02 Aug 21 at 12:51PM
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
Back to Top
timur View Drop Down
Beginner
Beginner


Joined: 23 Jul 21
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote timur Quote  Post ReplyReply Direct Link To This Post Posted: 02 Aug 21 at 1:50PM
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
Back to Top
Ingo View Drop Down
Moderator Group
Moderator Group
Avatar

Joined: 29 Oct 05
Status: Offline
Points: 3524
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ingo Quote  Post ReplyReply Direct Link To This Post Posted: 02 Aug 21 at 8:32PM
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

Back to Top
timur View Drop Down
Beginner
Beginner


Joined: 23 Jul 21
Status: Offline
Points: 6
Post Options Post Options   Thanks (0) Thanks(0)   Quote timur Quote  Post ReplyReply Direct Link To This Post Posted: 03 Aug 21 at 7:37AM
Thanks a lot
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store