It is currently Sun Nov 17, 2019 11:32 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3
Author Message
 Post subject: Re: [Module] PurePDF
PostPosted: Thu Feb 01, 2018 8:46 pm 
Offline
User
User

Joined: Wed Jan 31, 2018 4:03 pm
Posts: 11
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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Thu Feb 01, 2018 10:21 pm 
Offline
Enthusiast
Enthusiast

Joined: Fri Apr 20, 2012 8:09 pm
Posts: 283
Wolfgang2,

If you want to attach a file use the command to attach a file:
Code:
pdf_EmbedFile("filename","description of this file if you like")

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/viewtopic.php?p=517703#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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Fri Jun 01, 2018 9:37 am 
Offline
User
User

Joined: Wed Jan 31, 2018 4:03 pm
Posts: 11
normeus, thanks for the explenation and sorry for the long delay of my reply.
So, this is a feature. All OK.

Thank you,
Wolfgang2


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Fri Jun 01, 2018 1:03 pm 
Offline
User
User

Joined: Wed Jan 31, 2018 4:03 pm
Posts: 11
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:

Code:
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$)


This does crash the program with a memory access error in line 1230 of PurePdfModule:
Code:
formatID     = ipdf_EndianW(*subtable\format)

Code:
[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)


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


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Wed Jul 18, 2018 6:50 pm 
Offline
Enthusiast
Enthusiast

Joined: Wed Aug 03, 2011 4:52 am
Posts: 215
Location: Beirut, Lebanon
Hello:
Seems not working with unicode strings:

Code:
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")


any tips?

thanks

_________________
PureBasic: Surprisingly simple, diabolically powerful


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Sun May 26, 2019 11:30 am 
Offline
New User
New User

Joined: Wed Nov 09, 2016 9:55 am
Posts: 6
Location: Dijon, France
Thank you, my problem (specific font on Mac Osx) is now fixed. PDF file is now perfect !

Very Good work, useful !

_________________
Philippe GEORGES F1HSB
Amateur Radio Station VHF-UHF
f1hsb@sfr.fr


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Mon Jun 10, 2019 12:04 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 943
Location: Germany
'PurePDF' has been replaced by 'pbPDFModule.pbi'

_________________
Sorry for my English. My language is German.
(Translated with http://www.DeepL.com/Translator)

Download of PureBasic - Modules (GitHub)

[Windows 10 x64] [PB V5.7x]


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Wed Nov 06, 2019 10:33 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1033
Location: Portugal
Trying to display € in PDF using code below:-

Code:
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),"")


Running on my MAC the € sign does not appear at all.

_________________
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.


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] PurePDF
PostPosted: Wed Nov 06, 2019 11:33 am 
Offline
Addict
Addict

Joined: Fri Aug 28, 2015 6:10 pm
Posts: 1033
Location: Portugal
A little more info

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.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 39 posts ]  Go to page Previous  1, 2, 3

All times are UTC + 1 hour


Who is online

Users browsing this forum: Justin and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye