DrawText not working correctly
DrawText not working correctly
I am working with pdf documents, and I wrote an application for the folks in our document control to electronically 'stamp' the documents they received with a date. I essentially have used the sample in the DrawText (pdf) in the online documentation, except I use some math for dynamic positioning. For most documents, everything works as expected. But for a few documents, the text it writes is squished. The height of the text is what it should be, but the width is so skinny it looks like vertical lines. Anyone have any suggestions? I can post the code if it would help, but like I said, it is basically copy/paste from the sample.
Re: DrawText not working correctly
Hi Shollyd,
It would be helpful if you could provide the code+inout document used however before you do so please try this:
Use the NormalizePage method https://www.gdpicture.com/guides/gdpicture/Gd ... rmalize%2C . Use this before drawing the text on your PDF.
The normalize method should usually be used on PDFs before using drawing methods.
Let me know if this solves your issue.
Regards
It would be helpful if you could provide the code+inout document used however before you do so please try this:
Use the NormalizePage method https://www.gdpicture.com/guides/gdpicture/Gd ... rmalize%2C . Use this before drawing the text on your PDF.
The normalize method should usually be used on PDFs before using drawing methods.
Let me know if this solves your issue.
Regards
Re: DrawText not working correctly
Well, it may have very well have fixed my issue. Unfortunately, I get a "NormalizePage is not a member of GdPicturePDF" error. I imagine this is because we are still using GdPicture 10. While it is possible I can convince my company to upgrade, that doesn't help me in the short term. Unless you have any other ideas, I may have to back up and punt. Ultimately, I convert these pdfs to tiffs for use with our online system. So, for these, I may convert to tiff, then draw the date on the tiff rather than drawing on the pdf and then converting to tiff.
Re: DrawText not working correctly
Not to get too far off subject here, but I am writing the code to convert to a tif first, then add the stamp (so I have more control over the text size), and I got everything to work fine, except when I save it, I only get one page.
I found examples elsewhere where I add each subsequent page with TiffAddToMultiPageFile, but why? Is there a method that saves all pages at once?
(I left out the drawtext method as it was irrelevant)
Code: Select all
Dim originalimage As Integer = oGdPictureImaging.TiffCreateMultiPageFromFile("C:\Original.tif")
Dim TiffCompression As GdPicture10.TiffCompression = oGdPictureImaging.GetTiffCompression(originalimage)
result = oGdPictureImaging.TiffSaveAsMultiPageFile(originalimage, "C:\Output.tif", TiffCompression)
(I left out the drawtext method as it was irrelevant)
Re: DrawText not working correctly
Check the font used in the PDF document: Ensure that the font used in the document is available and supported by the PDF library you're using. If the font is not supported, you may need to try a different font or find a way to add the missing font to your library.
feudle
feudle
Re: DrawText not working correctly
I don't think it's about the font the OP is using. By the way, this thread is already three years old. It should have been closed a long time ago.mariah9x wrote: ↑Fri Mar 31, 2023 9:01 amCheck the font used in the PDF document: Ensure that the font used in the document is available and supported by the PDF library you're using. If the font is not supported, you may need to try a different font or find a way to add the missing font to your library.
positive f words
Who is online
Users browsing this forum: No registered users and 1 guest