[Module] PurePDF
Re: [Module] PurePDF
Dear normeus,
I do know and understand all this.
My question is regarding the opposite behaviour: I do not want to have two references to the same embedded file in the "Attachments" sidebar.
I observed that if you add a file annotation ( pdf_SetAFile() ) with the method from the Tutorial29, the embedded file shows up twice in the PDF.
To see that effect:
- Run Tutorial29
- In Acrobat Reader, on the left side, open the sidebar for "Attachments".
- See the same file showing up twice. Usually ( but not always ) you can click-open just one of the two.
I did look at the created PDF file today and it seems that the embedded file is just embedded once, indeed.
But it does show up twice in the "Attachments" sidebar in Acrobat Reader.
I do not understand PDF format and in the text edit, it was a mixture of text and binary. But it seems the issue is that PurePDF creates two references to the embedded file if you use pdf_SetAFile this way. Obviously it must create a reference when you pdf_EmbedFile() . But then it seems to create a 2nd one when you create the file annotation.
So, this may be called a bug.
I had a quick look in the PurePDF sources, but they are too big to understand without any documentation in a short time.
Thank you,
Wolfgang
I do know and understand all this.
My question is regarding the opposite behaviour: I do not want to have two references to the same embedded file in the "Attachments" sidebar.
I observed that if you add a file annotation ( pdf_SetAFile() ) with the method from the Tutorial29, the embedded file shows up twice in the PDF.
To see that effect:
- Run Tutorial29
- In Acrobat Reader, on the left side, open the sidebar for "Attachments".
- See the same file showing up twice. Usually ( but not always ) you can click-open just one of the two.
I did look at the created PDF file today and it seems that the embedded file is just embedded once, indeed.
But it does show up twice in the "Attachments" sidebar in Acrobat Reader.
I do not understand PDF format and in the text edit, it was a mixture of text and binary. But it seems the issue is that PurePDF creates two references to the embedded file if you use pdf_SetAFile this way. Obviously it must create a reference when you pdf_EmbedFile() . But then it seems to create a 2nd one when you create the file annotation.
So, this may be called a bug.
I had a quick look in the PurePDF sources, but they are too big to understand without any documentation in a short time.
Thank you,
Wolfgang
Re: [Module] PurePDF
Wolfgang2,
If you want to attach a file use the command to attach a file:
You don't need anything else. The rest of example 29 shows how to create an Annotation which points to the internal file.
The side effect is that you see 2 pointers to the attachment.
1 from Annotation and 2nd one from Attachment.
I use annotations because the people that use my pdfs do not know how to look at attachments tab so I have to create a "click on this link Annotation."
They will never know there are two links.
Both of the links should work the same. if they don't you might have a setting in your pdf reader that prevents opening attachments or annotations with attachments.
For more info about Attachments see:
http://www.purebasic.fr/english/viewtop ... 03#p517703
Thank you.
Norm.
If you want to attach a file use the command to attach a file:
Code: Select all
pdf_EmbedFile("filename","description of this file if you like")
The side effect is that you see 2 pointers to the attachment.
1 from Annotation and 2nd one from Attachment.
I use annotations because the people that use my pdfs do not know how to look at attachments tab so I have to create a "click on this link Annotation."
They will never know there are two links.
Both of the links should work the same. if they don't you might have a setting in your pdf reader that prevents opening attachments or annotations with attachments.
For more info about Attachments see:
http://www.purebasic.fr/english/viewtop ... 03#p517703
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] PurePDF
normeus, thanks for the explenation and sorry for the long delay of my reply.
So, this is a feature. All OK.
Thank you,
Wolfgang2
So, this is a feature. All OK.
Thank you,
Wolfgang2
Re: [Module] PurePDF
normeus, I have another issue with purePDF:
Embedding fonts that are on windows system as "TrueType collection font file" ( .ttc ) crashes purePDF.
I need to create chinese PDF files that need to be readable on any PC, so font needs to be embedded.
As I cannot guarantee which fonts are available on the PC that runs my program, I had the idea to let the user choose a font in the program setup.
Now, the issue is that there is no way to see if a font is regular truetype ( .ttf) or the above mentioned TrueType font collection ( .ttc)
I am also not awary of any way to check this within the PB code.
The fact that trying to embedd a .ttc font crashes the program with an memory access error makes this a pretty bad issue.
Excample code:
This does crash the program with a memory access error in line 1230 of PurePdfModule:
The same code with "SimHei" Font ( .ttf) does work as expected.
Unfortunately I am not good enough in either, PB or PDF, to fix that issue on my own.
So, any hint where to look at / what to do is very appreciated.
Thank you,
Wolfgang2
Embedding fonts that are on windows system as "TrueType collection font file" ( .ttc ) crashes purePDF.
I need to create chinese PDF files that need to be readable on any PC, so font needs to be embedded.
As I cannot guarantee which fonts are available on the PC that runs my program, I had the idea to let the user choose a font in the program setup.
Now, the issue is that there is no way to see if a font is regular truetype ( .ttf) or the above mentioned TrueType font collection ( .ttc)
I am also not awary of any way to check this within the PB code.
The fact that trying to embedd a .ttc font crashes the program with an memory access error makes this a pretty bad issue.
Excample code:
Code: Select all
XIncludeFile "PurePdfModule.pbi"
Global title.s = "PDF font embedding test"
PDF::Create()
PDF::AddPage()
PDF::SetFont("SimSun","",12)
PDF::Text(10,10,"这是一个嵌入式字体(SimSun Size 12)")
Define file$="purePDF_EmbedFonts.pdf"
PDF::Save(file$)
RunProgram(file$)
Code: Select all
formatID = ipdf_EndianW(*subtable\format)
Code: Select all
[14:01:08] Waiting for executable to start...
[14:01:08] Executable type: Windows - x64 (64bit, Unicode)
[14:01:08] Executable started.
[14:01:08] [ERROR] PurePdfModule.pbi (Line: 1230)
[14:01:08] [ERROR] Invalid memory access. (read error at address 178311806)
Unfortunately I am not good enough in either, PB or PDF, to fix that issue on my own.
So, any hint where to look at / what to do is very appreciated.
Thank you,
Wolfgang2
Re: [Module] PurePDF
Hello:
Seems not working with unicode strings:
any tips?
thanks
Seems not working with unicode strings:
Code: Select all
XIncludeFile "E:\install\dvd1\dev_soft\purebasic\extra\PurePdfModule\PurePdfModule.pbi"
;XIncludeFile "PurePdfModule.pbi"
;Unicode example
;===============
Define File$
File$=GetFilePart(#PB_Compiler_File)
File$=Mid(File$,1,Len(File$)-Len(GetExtensionPart(File$))-1)
PDF::Create()
PDF::AddPage()
PDF::SetFont("Arial","",28)
PDF::Text(20,30,"Hello السلام عليكم")
PDF::Save(File$+".pdf")
RunProgram(File$+".pdf")
thanks
PureBasic: Surprisingly simple, diabolically powerful
-
- New User
- Posts: 6
- Joined: Wed Nov 09, 2016 9:55 am
- Location: Dijon, France
Re: [Module] PurePDF
Thank you, my problem (specific font on Mac Osx) is now fixed. PDF file is now perfect !
Very Good work, useful !
Very Good work, useful !
- Thorsten1867
- Addict
- Posts: 1366
- Joined: Wed Aug 24, 2005 4:02 pm
- Location: Germany
Re: [Module] PurePDF
'PurePDF' has been replaced by 'pbPDFModule.pbi'
Translated with http://www.DeepL.com/Translator
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
Download of PureBasic - Modules
Download of PureBasic - Programs
[Windows 11 x64] [PB V5.7x]
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: [Module] PurePDF
Trying to display € in PDF using code below:-
Running on my MAC the € sign does not appear at all.
Code: Select all
IncludeFile "pbPDFModule.pbi"
PDF::Create(0)
PDF::AddPage(0)
PDF::SetFont(0, "Arial", "B", 16)
PDF::Cell(0, StrF(PDF::GetPageWidth(0), 0) + "x" + StrF(PDF::GetPageHeight(0), 0) + "€m€m€", 40, 10, #True)
PDF::Save(0,"Testing.PDF")
RunProgram("Open" ,Chr(34) + "Testing.PDF" + Chr(34),"")
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
-
- Addict
- Posts: 1309
- Joined: Fri Aug 28, 2015 6:10 pm
- Location: Portugal
Re: [Module] PurePDF
A little more info
Changed € to char(128) and it shows a euro symbol in the pdf.
Changed € to char(128) and it shows a euro symbol in the pdf.
Any intelligent fool can make things bigger and more complex. It takes a touch of genius — and a lot of courage to move in the opposite direction.
- skinkairewalker
- Enthusiast
- Posts: 635
- Joined: Fri Dec 04, 2015 9:26 pm
Re: [Module] PurePDF
have a way to import other pdf and edit it ?