Page 19 of 32
Re: PurePDF Version 2.0
Posted: Sun Jun 10, 2012 3:04 am
by IdeasVacuum

Still not working here:
Code: Select all
dPtcm.d = ((1/72) * 25.4)
dW.d = 794.00 * dPtcm
dH.d = 1123.00 * dPtcm
sPDF_PAGE_FORMAT_CUSTOM.s = StrD(dW,2) + "," + StrD(dH,2)
;Debug sPDF_PAGE_FORMAT_CUSTOM
Define sPdfName.s = "C:\TestA4Format200dpi.pdf"
Define sImageFile.s = "TestA4Format200dpi.png"
pdf_Create("P","pt",sPDF_PAGE_FORMAT_CUSTOM)
pdf_AddPage()
pdf_Image(sImageFile,0,0,dW)
pdf_Save(sPdfName)
;View PDF created
RunProgram(sPdfName)
No image and PDF Page Size is 98.8 x 139.8mm (Adobe Reader v10.1.3)
Re: PurePDF Version 2.0
Posted: Sun Jun 10, 2012 10:01 am
by ABBKlaus
What are the dimensions (in pixels) of your image IdeasVacuum ?
Re: PurePDF Version 2.0
Posted: Sun Jun 10, 2012 3:51 pm
by IdeasVacuum
Hi ABBKlaus, the 200dpi image is size A4, verifies as 794 x 1123 pix in Irfan View (and the OS explorer).
The files we have been testing are available for download:
Test Files
Re: PurePDF Version 2.0
Posted: Sun Jun 10, 2012 5:50 pm
by ABBKlaus
If you want the PDF size equal to 210 x 297 mm you can do it this way :
Code: Select all
ptinch.d=1/72 ; each point is ~0.014" (1/72 of an inch)
ptcm.d=(1/72)*25.4 ; each point is ~0.35 mm
ptx=210 / ptcm ; calculate 210 mm into point
pty=297 / ptcm ; calculate 297 mm into point
PDF_PAGE_FORMAT_CUSTOM.s=Str(ptx)+","+Str(pty)
sPdfName.s = "TestA4Format200dpi.pdf"
sImageFile.s = "TestA4Format200dpi.png"
pdf_Create("P","pt",PDF_PAGE_FORMAT_CUSTOM)
pdf_SetMargins(0,0,0)
pdf_SetFillColor(230,230,230) ;Light Gray
pdf_AddPage()
pdf_Image(sImageFile,0,0,ptx,pty)
pdf_Save(sPdfName)
;View PDF created
RunProgram(sPdfName)
Re: PurePDF Version 2.0
Posted: Sun Jun 10, 2012 10:31 pm
by IdeasVacuum
Oh yes, that works perfectly!
Thanks again ABBKlaus
Re: PurePDF Version 2.0
Posted: Tue Jun 12, 2012 11:37 pm
by Olby
Is there any way I can change the PDF Producer tag with my own text. I know it's not meant to be changed but the files produced by my application are sent to clients and we need to put our company's credentials in there. Thanks.
Re: PurePDF Version 2.0
Posted: Tue Jun 19, 2012 1:49 pm
by MachineCode
Can I request that PurePDF support passwords for opening the created PDF document in future? Thanks! (And I mean natively, and not with a JavaScript hack).
Re: PurePDF Version 2.0
Posted: Wed Jul 18, 2012 2:31 pm
by Puffolino
I just downloaded the PurePDF lib and tested all tutorials, what a nice package -- thanks
I started "decoding" some HTML-Tags (<b>, </b> and <br>), which can be seen in the code below. But I would need a kind of a text flow and have no idea how to do this. I have an image on the top right position of a page and a loto of text which should be drawn on the page (except over the image).
It should look like that (t=text, *=image):
__________
tt ttttt . ******
ttttt tt . ******
tt ttttt . ******
ttttt tt
ttttt ttttt tttttt
tt tt ttt tttt ttt
tttttt
__________
Can this be done easily?
I have also another problem, some jpg files are not displayed in the resulting pdf file. PB is able to display these images with no problem and as there are no big differences in the jpg parameters (image size, DPI etc.) it seems to be that progressive encoding is not supported.
As I am not able to change the image sources, is it possible to do a trick do embed these jpg files into a pdf file without creating temporary files for each image?
Code: Select all
Procedure WriteText(Text.s)
Protected FlagBoldOn
Protected FlagBoldOff
Protected FlagBreak
Repeat
FlagBreak=FindString(Text,"<br>",FlagBreak)
If FlagBreak
WriteText(Left(Text,FlagBreak-1))
Text=Trim(Mid(Text,FlagBreak+4))
If Len(Text)
WriteText(Text)
EndIf
Break
EndIf
FlagBoldOn=FindString(Text,"<b>",FlagBoldOff)
If FlagBoldOn
pdf_Write(5,Left(Text,FindString(Text,"<b>",1) - 1))
FlagBoldOff=FindString(Text,"</b>",FlagBoldOn)
If FlagBoldOff=0
FlagBoldOff=Len(Text)
EndIf
pdf_SetFont(#FontFace,"B",14)
pdf_Write(5,Mid(Text,FlagBoldOn+3,FlagBoldOff-FlagBoldOn-3))
pdf_SetFont(#FontFace,"",12)
FlagBoldOff+4
Else
pdf_Write(5,Mid(Text,FlagBoldOff))
pdf_Ln()
Break
EndIf
ForEver
EndProcedure
Re: PurePDF Version 2.0
Posted: Wed Aug 01, 2012 3:23 pm
by yrreti
Removed this question and transfered this post to the Coding Questions section
where ABBKlaus was able to help me.
Thanks for providing this nice library.
yrreti
Re: PurePDF Version 2.0
Posted: Wed Aug 01, 2012 3:46 pm
by Paul
Is this PurePDF tool able to load a PDF file, make some additions and then resave as PDF ?
If not, does anyone know of some existing code or command line tool to do this?
Thanks.
Re: PurePDF Version 2.0
Posted: Wed Aug 01, 2012 11:21 pm
by IdeasVacuum
It is currently used to create PDF files. You can do more with GhostScript, but for commercial use the license could be an issue. I made an inquiry not so long ago and decided not to bother when I received a reply consisting of a long list of questions.
Re: PurePDF Version 2.0
Posted: Tue Aug 28, 2012 6:24 am
by Oliver13
ABBKlaus wrote:Update :
- added WMF support (requested by Oliver13)
Hi Klaus,
I haven't been here for a while: thank you very much !!!
Oliver
Re: PurePDF Version 2.0
Posted: Tue Jan 29, 2013 2:42 pm
by Rings
i need a simple JPEG/PNG 2 PDf converter ,
i remembered this thread, donwloaded the stuff and
voila, it did not work with 5.10 .
Code: Select all
Procedure MEM_DataReplace(*aData.MEM_DataStructure, aSource.s, aDest.s)
.
.
.
If (vFind > 0)
vReturn = MEM_DataInit(*aData, vMaxSize + (vFind*(vDestLen - vSourceLen))) = #False
EndIf
throws a boolean error .
normaly, i'm able to fix such errors bymyself, but i'm totaly lost in this case.
And yes, i never would type such a construct

anyone can help me (and the community) to fix that errors in the lib ?
Re: PurePDF Version 2.0
Posted: Tue Jan 29, 2013 3:44 pm
by infratec
Hi Rings,
to be backward compatible I would do it like this:
Code: Select all
If (vFind > 0)
If MEM_DataInit(*aData, vMaxSize + (vFind*(vDestLen - vSourceLen))) = #False
vReturn = #True
Else
vReturn = #False
EndIf
EndIf
I hope that's right.
Bernd
Re: PurePDF Version 2.0
Posted: Wed Jan 30, 2013 8:13 pm
by ABBKlaus
Thanks for reporting Rings and infratec.
I have uploaded fixed archives (no version change)
http://www.purebasicpower.de/?PurePDF