Page 2 of 3

Re: [Module] PurePDF

Posted: Thu Sep 28, 2017 7:40 pm
by Thorsten1867
loulou2522 wrote:Problem with

Code: Select all

Structure MEM_DataStructure
   pData.i       ; Pointer to memory
   lMaxSize.i    ; Max. reserved memory in bytes
   lCurSize.i    ; Current last possition of data in bytes
 EndStructure

Purebasic say
Structure yet declared in a residant file
Changed:

Code: Select all

CompilerIf Defined(MEM_DataStructure,#PB_Structure)=0
    Structure MEM_DataStructure
      pData.i       ; Pointer to memory
      lMaxSize.i    ; Max. reserved memory in bytes
      lCurSize.i    ; Current last possition of data in bytes
    EndStructure
  CompilerEndIf

Re: [Module] PurePDF

Posted: Thu Sep 28, 2017 9:40 pm
by Thorsten1867
Update:
- Bugfixes
- Examples (Tutorial 1-32) added

Re: [Module] PurePDF

Posted: Fri Sep 29, 2017 9:05 am
by Lord
The question still stands:
Is this modul a derivate from PurePDF v2.24 or v2.25?

Re: [Module] PurePDF

Posted: Fri Sep 29, 2017 9:09 am
by falsam
I tested all the examples. Thank you for sharing. ^-^

Small minor errors in these three tutorials.

Tutorial02
Module item 'SetY()' Not found.
changed: pdf_SetY() => PDF::SetPosY()


Tutorial03 - Tutorial04
Module item 'SetX()' not found.
changed: pdf_SetX() => PDF::SetPosX()

Module item 'SetY()' not found.
changed: pdf_SetY() => PDF::SetPosY()

Re: [Module] PurePDF

Posted: Fri Sep 29, 2017 12:07 pm
by Thorsten1867
falsam wrote:I tested all the examples. Thank you for sharing. ^-^

Small minor errors in these three tutorials.

Tutorial02
Module item 'SetY()' Not found.
changed: pdf_SetY() => PDF::SetPosY()


Tutorial03 - Tutorial04
Module item 'SetX()' not found.
changed: pdf_SetX() => PDF::SetPosX()

Module item 'SetY()' not found.
changed: pdf_SetY() => PDF::SetPosY()
==> fixed

Re: [Module] PurePDF

Posted: Sat Sep 30, 2017 2:33 pm
by Lord

Re: [Module] PurePDF

Posted: Sun Oct 01, 2017 1:46 pm
by Thorsten1867
Upgrade PurePdfModule to PurePDF V2.26.

Re: [Module] PurePDF

Posted: Sun Oct 01, 2017 1:48 pm
by Thorsten1867
It based now on PurePDF V2.26.

Re: [Module] PurePDF

Posted: Mon Oct 02, 2017 9:23 am
by Lord
Thorsten1867 wrote:...
It based now on PurePDF V2.26.
Thanks for this information.

Still:
Help file says:
History wrote:History

Version 2.24 (13.2.2013)
...
So what are the changes from 2.24 to 2.25 to 2.26?
Where can I find the original PurePDF v2.26?

Re: [Module] PurePDF

Posted: Mon Oct 09, 2017 7:19 am
by Thorsten1867
The help file belongs to the original PurePDF include.

Gesendet von meinem Aquaris X mit Tapatalk

Re: [Module] PurePDF

Posted: Mon Oct 09, 2017 7:22 am
by Thorsten1867
http://www.purebasic.fr/english/viewtop ... 02#p504002

Gesendet von meinem Aquaris X mit Tapatalk

Re: [Module] PurePDF

Posted: Tue Nov 28, 2017 4:54 pm
by collectordave
Hi

Great module

Just one problem. I am trying to add images to a pdf document and it seems to fail.

Here is my test code

Code: Select all

IncludeFile "PurePdfModule.pbi"

PDF::Create()

PDF::AddPage()

PDF::Image("165134.jpg",80,80,50,50)
;PDF::Image("PurePDFLogo.jpg",80,80,50,50)
File$ = "Test.pdf"
PDF::Save(file$)
RunProgram(file$)
When I use the PurePDFLogo.jpg it works using any other jpg image it fails.

Any Ideas?

collectordave

Re: [Module] PurePDF

Posted: Tue Nov 28, 2017 5:59 pm
by collectordave
Managed to get images on the page using imagemem

Code: Select all

UseJPEGImageDecoder()
UseJPEGImageEncoder()

IncludeFile "PurePdfModule.pbi"

PDF::Create("","mm",PDF::#PAGE_FORMAT_A4)

PDF::AddPage()

StampImageID = LoadImage(#PB_Any,"165134.jpg")


;????????????????/
ResizeImage(StampImageID,590,250)

*Buffer = EncodeImage(StampImageID,#PB_ImagePlugin_JPEG)

PDF::ImageMem("165134.jpg",*Buffer,MemorySize(*Buffer),0,10) 

File$ = "Test.pdf"
PDF::Save(file$)
RunProgram(file$)
Now the only thing is to get the image to fit in a standard 30mm X 30mm size. So now what size do I resize the image to get it to fit in a 30 X 30 box? Aspect ratio etc no bother.

Cheers

CD

Hm PS

Imagemem does it for you! Just need to read a little deeper.
PDF::ImageMem("165134.jpg",*Buffer,MemorySize(*Buffer),0,10,30,30)

Re: [Module] PurePDF

Posted: Wed Jan 31, 2018 4:14 pm
by Wolfgang2
Hi Thorsten1867,

Not sure if you feel like the PurePDF maintainer now. So, if not, that's OK.

My question is around pdf_SetAFile()
According to manual and examples, this needs a FileID which, in turn, is returned by a call to pdf_EmbedFile()
(The manual does not document any return value for pdf_EmbedFile, btw.)

So, this all works as expected, BUT:
The resulting PDF has the same file embedded twice:
Once from pdf_EmbedFile() and once again caused by pdf_SetAFile().
You can see that in the PDF created by example "tutorial29" where the "20k_c1.txt" is embedded twice.

This seems a waste. Is there any way to create a pdf_SetAFile with just one copy of the embedded file ?
could you put the return value of PB's ReadFile() into pdf_SetAFile() ?

Thank you,
Wolfgang2

Re: [Module] PurePDF

Posted: Wed Jan 31, 2018 6:04 pm
by normeus
the "SetA" commands are "Anotations"

Code: Select all

pdf_SetAText
pdf_SetAPopUp
pdf_SetAFile
pdf_EmbedFile() is a separate command which attaches a file at the end of your pdf.

If you are doing pdf_SetAFile then it takes the fileid created by pdf_EmbedFile and uses it
from the example:

Code: Select all

Define fileid=pdf_EmbedFile("20k_c1.txt","Attachments Pane")
link = pdf_Addlink()
pdf_SetAFile(link,fileid,-1,0,"Beschreibung","Der Titel",5,5,Date(),"Tag",0)
pdf_Cell(80,10,"This is a File annotation",1,1,#PDF_ALIGN_LEFT,#True,link)

Define file$="Tutorial29 Annotations+Actionsa.pdf"
try this code to display link 2x for the same file

Code: Select all

Define fileid=pdf_EmbedFile("20k_c1.txt","Attachments Pane")
link = pdf_Addlink()
pdf_SetAFile(link,fileid,-1,0,"Beschreibung","Der Titel",5,5,Date(),"Tag",0)
pdf_Cell(80,10,"This is a File annotation",1,1,#PDF_ALIGN_LEFT,#True,link)
pdf_SetAFile(link,fileid,-1,0,"Beschreibung","Der Titel",5,5,Date(),"Tag",0)
pdf_Cell(80,10,"This is other File annotation",1,1,#PDF_ALIGN_LEFT,#True,link)

Define file$="Tutorial29 Annotations+Actionsa.pdf"
if you look at the output pdf it will be the same size as the previous pdf

Norm.