[Module] pbPDF-Module
- DeanH
- Enthusiast
- Posts: 230
- Joined: Wed May 07, 2008 4:57 am
- Location: Adelaide, South Australia
- Contact:
Re: [Module] pbPDF-Module
It could be the viewer. I'm using Foxit.
-
- Enthusiast
- Posts: 143
- Joined: Fri Mar 29, 2013 4:55 pm
- Location: The Netherland
Re: [Module] pbPDF-Module
Is there a solution for "unicode"?
Example: "Styczeń" (Polish) is displayed as "SryczeD".
Kind regards,
Little_man
Example: "Styczeń" (Polish) is displayed as "SryczeD".
Kind regards,
Little_man
-
- Enthusiast
- Posts: 503
- Joined: Tue Oct 14, 2014 12:09 pm
Re: [Module] pbPDF-Module
Maybe you have to load a police which allow this kind of characterLittle_man wrote: ↑Tue Jan 04, 2022 7:55 am Is there a solution for "unicode"?
Example: "Styczeń" (Polish) is displayed as "SryczeD".
Kind regards,
Little_man
Re: [Module] pbPDF-Module
Did you found solution?
Little_man wrote: ↑Tue Jan 04, 2022 7:55 am Is there a solution for "unicode"?
Example: "Styczeń" (Polish) is displayed as "SryczeD".
Kind regards,
Little_man
-
- Enthusiast
- Posts: 143
- Joined: Fri Mar 29, 2013 4:55 pm
- Location: The Netherland
Re: [Module] pbPDF-Module
I have not found a solution to the problem
Re: [Module] pbPDF-Module
This is usually related to the font you are using. For coding I use a free font which happens to also have the character you need.
For my example, first download "Fira code" font from github : https://github.com/tonsky/FiraCode
( if you have a font that contains the character you need, use that font, but you have to make sure pbPDF finds it like I am doing with the example with Fira Code or it will use the default font and you'll see a "D")
I hope this helps.
Norm
For my example, first download "Fira code" font from github : https://github.com/tonsky/FiraCode
( if you have a font that contains the character you need, use that font, but you have to make sure pbPDF finds it like I am doing with the example with Fira Code or it will use the default font and you'll see a "D")
Code: Select all
XIncludeFile "..\pbPDFModule.pbi"
Define File$="pbPDF-Example_Unicode_v1.pdf"
#PDF = 1
; Create an instance of PDF
If PDF::Create(#PDF)
; Always add a page to create a PDF or you'll get an error
; Page size and orientation is optional, I like to add it because you can have multiple page sizes in a PDF
PDF::AddPage(#PDF,PDF::#Landscape,PDF::#format_letter)
; specialty unicode font, which contains the character you need
PDF::EMbedFont(#PDF, "C:\WINDOWS\Fonts\FIRACODE-REGULAR.TTF","FiraCode","",PDF::#Unicode)
PDF::SetFont(#PDF, "FiraCode", "", 14)
PDF::PlaceText(#PDF, "This is an embedded Unicode-font (Fira Code) Styczeń or using chr($0144) = "+Chr($0144), 10, 50)
PDF::Close(#PDF, File$)
EndIf
RunProgram(File$)
Norm
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
-
- Enthusiast
- Posts: 143
- Joined: Fri Mar 29, 2013 4:55 pm
- Location: The Netherland
Re: [Module] pbPDF-Module
Normeus,
Thank you for the code but then I have another question; how to remove the square in front of the text.
Kind regards,
Little_man
Thank you for the code but then I have another question; how to remove the square in front of the text.
Kind regards,
Little_man
Re: [Module] pbPDF-Module
Make sure you have the latest pbPDF-Module.
pbPDF-Module
[edit: figured out that to add images the URL has to end in an actual png or jpg file. It can not be an econded name like "Tq6cC"]
here's a link to an img with the results I don't get a square, with the sample code I posted:
Norm.
pbPDF-Module
Code: Select all
;/ [ PB V5.7x / All OS ]
;/
;/ © 2022 Thorsten1867 (12/2018)
;/ ( based on 'PurePDF' by LuckyLuke / ABBKlaus / normeus )
;/
; Last Update: 04.05.2022
here's a link to an img with the results I don't get a square, with the sample code I posted:
Norm.
Last edited by normeus on Thu Dec 22, 2022 7:41 pm, edited 1 time in total.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
-
- Enthusiast
- Posts: 143
- Joined: Fri Mar 29, 2013 4:55 pm
- Location: The Netherland
Re: [Module] pbPDF-Module
Normeus,
Problem solved, there was an issue with me !!..
Kind regards,
Little_man
Problem solved, there was an issue with me !!..
Kind regards,
Little_man
- skinkairewalker
- Enthusiast
- Posts: 637
- Joined: Fri Dec 04, 2015 9:26 pm
Re: [Module] pbPDF-Module
have a way to import other pdf and edit it ?
Re: [Module] pbPDF-Module
Infratec has some code, using PDFium.dll that might do what you need here:
viewtopic.php?p=553210#p553210
Norm
viewtopic.php?p=553210#p553210
Norm
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
- skinkairewalker
- Enthusiast
- Posts: 637
- Joined: Fri Dec 04, 2015 9:26 pm
Re: [Module] pbPDF-Module
I would like to add text, images and etc to an existing pdf exported from an office [ word ]
Re: [Module] pbPDF-Module
PB ide v6.03 has a new check for invalid Chr() numbers. You get a compile error, @idle placed a request to change the error to a warning on October 16, 20023. viewtopic.php?p=609396#p609396
If you compile pbPDF-Module and you get an error Chr() out of range, alternative is to compile from the command line. If you are using English for the pdfs you create with pbPDF-Module then you can do the following change to be able to compile from IDE:
It might work for other languages, but I only tried it using English.
Here is a link to @idle's UTF16 module:(it's a nice read, for people using different languages of the world in their programs)
viewtopic.php?p=592461#p592461
Thank you.
Norm.
If you compile pbPDF-Module and you get an error Chr() out of range, alternative is to compile from the command line. If you are using English for the pdfs you create with pbPDF-Module then you can do the following change to be able to compile from IDE:
Code: Select all
;around line 5893
For i=0 To 65535
If i >= 55296 And i<=57343 ; skip the chraracters ide now marks as error
Continue
Else
If FindMapElement(PDF()\Fonts()\CharWidth(), Chr(i))
objStrg + Str(i) + " [" + Str(PDF()\Fonts()\CharWidth(Chr(i))) + "] "
EndIf
EndIf
Next
Here is a link to @idle's UTF16 module:(it's a nice read, for people using different languages of the world in their programs)
viewtopic.php?p=592461#p592461
Thank you.
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
Re: [Module] pbPDF-Module
Thorsten1867 thank you for a great library. I am interested in the use of Polish letters. The example provided by normeus works very well. For several days I tried to use other fonts, Windows system fonts and the Lato font. However, this did not produce the expected result. Maybe my dear colleagues will tell how to use Windows system fonts for polish letters and why the example below, based on normeus example, with Lato fonts does not work. Lato fonts can be downloaded here:
https://www.latofonts.com/lato-free-fonts/
https://www.latofonts.com/lato-free-fonts/
Code: Select all
XIncludeFile "..\pbPDFModule.pbi"
Define File$="pbPDF-Example_forLato.pdf"
#PDF = 1
; Create an instance of PDF
If PDF::Create(#PDF)
; Always add a page to create a PDF or you'll get an error
; Page size and orientation is optional, I like to add it because you can have multiple page sizes in a PDF
PDF::AddPage(#PDF,PDF::#Landscape,PDF::#format_letter)
; specialty unicode font, which contains the character you need
PDF::EMbedFont(#PDF, "C:\WINDOWS\Fonts\Lato-Light.ttF","Lato","",PDF::#Unicode)
PDF::SetFont(#PDF, "lato", "", 14)
PDF::PlaceText(#PDF, "This is font Lato for Styczeń or other polish letters: ŻŹĆŃŁÓĄŚĘĘ żźćńłóśąę", 10, 50)
PDF::Close(#PDF, File$)
EndIf
RunProgram(File$)
Re: [Module] pbPDF-Module
Sorry that was part of the code I added. It should give you an error with font file not found. That's the problem, the file is not there. I'll have time to look at the code later today, I hope, meantime try this:
Notice that I used Lato black because Lato-Light does not show the special characters, you can also just unzip the fonts to a folder and call them for that folder.
Norm
Code: Select all
PDF::EMbedFont(#PDF,"c:/Users/"+UserName()+"/appdata/local/microsoft/windows/fonts/LATO-BLACK.TTF","Lato","",PDF::#Unicode)
PDF::SetFont(#PDF, "Lato", "", 14)
Norm
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari