Page 21 of 32

Re: PurePDF Version 2.0

Posted: Fri Jun 07, 2013 8:02 am
by ABBKlaus
Hi yrreti,

you are correct :shock:

The cidtogidmap memory must be released inside ipdf_PutFonts() put this procedure at the end of it and it should get fixed.

Code: Select all

    If Fonts()\cidtogidmap
      FreeMemory(Fonts()\cidtogidmap) ; Release cidtogidmap memory
      Fonts()\cidtogidmap=0
    EndIf
  Next

Re: PurePDF Version 2.0

Posted: Fri Jun 07, 2013 11:48 am
by ABBKlaus
Uploaded the corrected version of PurePDF v2.24.

http://www.purebasicpower.de/?download= ... B51X86.zip

BR Klaus

Re: PurePDF Version 2.0

Posted: Fri Jun 07, 2013 1:04 pm
by yrreti
Hi ABBKlaus

That was quick. Thanks very much.

Re: PurePDF Version 2.0

Posted: Thu Aug 29, 2013 12:43 pm
by Melow
Hi Klaus
ABBKlaus wrote:

Code: Select all

If ReadFile(0,"C:\somefile.txt")
  ASCII85.MEM_DataStructure
  ASCII85\pData=AllocateMemory(Lof(0))
  ASCII85\lCurSize=Lof(0)
  ASCII85\lMaxSize=Lof(0)
  ReadData(0,ASCII85\pData,Lof(0))
  CloseFile(0)
  
  Characters_per_line=60
  If pdf_ASCII85_Encode(@ASCII85,Characters_per_line)
    Message$=Chr(13)+Chr(13)+"Buffer = "+Str(ASCII85\lCurSize)+" Bytes !"
    Encoded_ASCII85$=PeekS(ASCII85\pData,-1,#PB_Ascii)
    MessageRequester("ASCII85 Encode",Encoded_ASCII85$+Message$)
    
    BufferLen=4096
    Buffer=AllocateMemory(BufferLen)
    If pdf_ASCII85_Decode(ASCII85\pData,ASCII85\lCurSize,Buffer,@OutBufferLen)=0
      Message$=Chr(13)+Chr(13)+"Buffer = "+Str(OutBufferLen)+" Bytes !"
      Decoded_ASCII85$=PeekS(Buffer,-1,#PB_Ascii)
      MessageRequester("ASCII85 Decoded",Decoded_ASCII85$+Message$)
    EndIf
  EndIf
EndIf
As

Code: Select all

pdf_ASCII85_Encode()
creates a new *pointer to
ASCII85\pData
... is there any way to free this memory again?
FreeMemory() did'nt work.

Thank you... absolut great library
Melow :-)

Re: PurePDF Version 2.0

Posted: Thu Aug 29, 2013 4:14 pm
by ABBKlaus
If used as lib : no (Since you can't free memory you do not own)
If used as includefile : yes

BR Klaus

Re: PurePDF Version 2.0

Posted: Fri Aug 30, 2013 3:12 am
by Melow
Hi Klaus

i loaded PurePDF as lib. Is it possible to implement something like pdf_ASCII85_free(*pointer) ?
Greetings Melow :-)

Re: PurePDF Version 2.0

Posted: Tue Sep 24, 2013 6:40 pm
by ABBKlaus
Hi Melow,

i uploaded a fixed PurePDF ;-)

http://www.purebasicpower.de/?download= ... B52X86.zip

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 4:58 am
by IdeasVacuum
Hi Klaus

The last cell of each row in my table needs to be multi-line - is it possible to have the other cells of the row 'grow' in height to match the multi-line cell, the way it does for an HTML table/MS Word table?

Image

Edit: In fact, if the last cell is drawn first, I should be able to mimic the HTML table by verifying the multi-cell height via pdf_GetMultiCellNewLines()

OK, in my loop below I verify the current Y position, draw the multi-cell (right side), verify it's height, then draw the other cells (left side) at the Y position. Works great, until a multi-cell is broken onto the next page (AutoPageBreak), which then trashes the Y posn as it's applied to the current page.........

Code: Select all

ForEach sTxt()

      pdf_SetX(113)
      dY = pdf_GetY()

      pdf_MultiCell(174,5,sTxt()\t5,1,#PDF_ALIGN_LEFT,1,0)
      
      iH = (5 * pdf_GetMultiCellNewLines())
      
      pdf_SetX(10)
      pdf_SetY(dY)
      
      pdf_Cell(25,iH,sTxt()\t1,1,#PdfNextLocnRight,#PDF_ALIGN_LEFT,1,0) 
      pdf_Cell(20,iH,sTxt()\t2,1,#PdfNextLocnRight,#PDF_ALIGN_LEFT,1,0)   
      pdf_Cell(40,iH,sTxt()\t3,1,#PdfNextLocnRight,#PDF_ALIGN_LEFT,1,0)   
      pdf_Cell(18,iH,sTxt()\t4,1,#PdfNextLocnNewLine,#PDF_ALIGN_LEFT,1,0)
Next
There must be a better way?

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 1:31 pm
by Loopingstar
ABBKlaus wrote:Hi Melow,

i uploaded a fixed PurePDF ;-)

http://www.purebasicpower.de/?download= ... B52X86.zip
Wouaouh ! Thank you ABBKlaus, i love this great lib! ;)
I have a question:
How to make inner "anchor" link in the PDF document ?
My goal is to create à "Choose your own adventure" like book, and I need to create links in the text chapters TO chapter titles ...

Example:

chapter 1
texttexttext
texttexttext
texttexttext

Go to chapter 17
Go to Chapter 2
Go to Chapter 5

--------------------------------------------------

chapter 2
texttexttext
texttexttext
texttexttext

Return to chapter 1
Go to chapter 124

-------------------------------------------------------

and when you click on the links, "scrolls" automatically to designated chapter.
Thank you

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 2:47 pm
by IdeasVacuum
There is a tutorial, Tutorial29:

Code: Select all

#PurePDF_Include=1
XIncludeFile "PurePDF.pb"

pdf_Create()
pdf_AddPage()
pdf_SetFont("Arial","U",16)

pdf_SetFillColor(224,235,255) 
pdf_SetTextColor(0,0,255) 

Define link = pdf_Addlink()
pdf_SetAText(link,-1,-1,"This is a text annotation","Text annotation",Date(),"",#PDF_AF_NOVIEW|#PDF_AF_TOGGLENOVIEW)
pdf_Cell(60,10,"Text annotation!",1,1,#PDF_ALIGN_LEFT,#True,link)

pdf_Ln()

link = pdf_Addlink() 
pdf_SetAPopUp(link,-1,-1,"This is a pop-up annotation"+Chr(13)+"Klick to see Pop-up!","Pop-up annotation",50,50,Date(),"",#PDF_AF_NOVIEW|#PDF_AF_TOGGLENOVIEW)
pdf_Cell(60,10,"Pop-up annotation!",1,1,#PDF_ALIGN_LEFT,#True,link)

pdf_Ln()

link = pdf_Addlink() 
pdf_SetALaunch(link,-1,-1,"calc.exe","","O","")
pdf_Cell(60,10,"Launch action!",1,1,#PDF_ALIGN_LEFT,#True,link)

Define file$="Tutorial29 Annotations+Actions.pdf"

pdf_Save(file$)
RunProgram(file$)
pdf_Addlink()
pdf_Link(X.f, Y.f, W.f, H.f, Link.l)
pdf_Image(FileName$, X.f, Y.f [, W.f [, H.f [, Link.l]]])
pdf_Cell(W.f [, H.f [, Text$ [, Border.l [, Ln.f [, Align$ [, Fill.l [, Link.l]]]]]]])
pdf_Write(H.f, Text$ [, Link.l])

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 2:55 pm
by Loopingstar
I saw it (I tried all examples Purepdf) but it did not help me.
The problem is that I have to make links to chapters do not exist (Example: I create chapter 7 and I have to make a link to Chapter 32, which does not yet exist).
Here is an exemple of PDF file generated: http://loopingstar.com/abc/demo.pdf


You forgot > pdf_SetLink(Link.l [, Y.f [, Page.l [, Url$]]])

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 3:18 pm
by IdeasVacuum
I have to make links to chapters do not exist
? :shock:
I'm not sure you mean what you say........

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 4:00 pm
by Loopingstar
Yet it is very clear. :D
Please, see PDF example...

So. i create the xml gradually, okay ?
So, I created Chapter 1.
Then I created Chapter 2.
Then I created in Chapter 3, and so on ....

But how do I, for example, to create in Chapter 2 a link to Chapter 5 (Chapter 5 has not yet been created since I'm in Chapter 2)?
Do you understand?

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 4:13 pm
by IdeasVacuum
...I'm sure I'm being very dumb here. I assume your issue is that the location of the start of any Chapter is 'unknown' because the pages are created on-the-fly with auto page break. If that is true, but the content of the chapters is static, then you can produce a link-less pdf with auto page break enabled, then study what you have got in terms of pages and where the chapters are. Then in your code you can change from auto to manual break and add the links required because you now know how many pages each chapter needs. You can for example, start each chapter on it's own page too.

Re: PurePDF Version 2.0

Posted: Tue Oct 01, 2013 4:56 pm
by Loopingstar
Yes, it is a good idea.
thank you IdeasVacuum , I'll try to dig this solution.