It is currently Wed Sep 18, 2019 9:10 pm

All times are UTC + 1 hour




Post new topic Reply to topic  [ 39 posts ]  Go to page 1, 2, 3  Next
Author Message
 Post subject: [Module] pbPDF-Module
PostPosted: Thu Jan 03, 2019 5:25 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
pbPDF - Module

Creating PDF documents

  • Support of form fields (e.g. text field, checkbox, radio button & combo box)
  • Encryption (password protection & access permissions)
  • Using the PB Packer Library instead of external compression procedures
  • Reading font and image headers only with PB commands instead of with Windows API
  • JPEG2000 image format support
  • Unicode character set support
  • 64-bit compatible

Code:
  ; ----- Basic Commands -----

  ; PDF::Create()                      - Create PDF document.
  ; PDF::AddPage()                     - Adds a (new) page to the document.
  ; PDF::BookMark()                    - Add bookmark
  ; PDF::Cell()                        - Prints a cell (rectangular area) with optional borders, background color and character string.
  ; PDF::DividingLine()                - Draws a line with the specified width.
  ; PDF::GetFontSize()                 - Get current fontsize (#Point/#Unit)
  ; PDF::GetMargin()                   - Get left, top, right or cell margin.
  ; PDF::GetMultiCellLines()           - Get the last value of newlines for pdf_MultiCell()
  ; PDF::GetPageHeight()               - Get current height of page.
  ; PDF::GetPageNumber()               - Returns the current page number.
  ; PDF::GetPageWidth()                - Get current width of page.
  ; PDF::GetPosX()                     - Returns the abscissa of the current position.
  ; PDF::GetPosY()                     - Returns the ordinate of the current position.
  ; PDF::GetStringWidth()              - Get width of a string in the current font.
  ; PDF::Image()                       - Puts an image in the page.
  ; PDF::Ln()                          - Performs a line break.
  ; PDF::MultiCell()                   - This method allows printing text with line breaks.
  ; PDF::MultiCellList()               - Add multicell with list elements
  ; PDF::PlaceText()                   - Place text at x, y position. 
  ; PDF::Rotate()                      - Perform a rotation around a given center.
  ; PDF::Save()                        - Save PDF under file name
  ; PDF::SetAutoPageBreak()            - Set auto page break mode and triggering margin.
  ; PDF::SetColorRGB()                 - Set RGB color for text, draw and fill  (#TextColor / #DrawColor / #FillColor).
  ; PDF::SetDashedLine()               - Set a dash pattern and draw dashed lines or rectangles.
  ; PDF::SetFont()                     - Sets the font used to print character strings.
  ; PDF::SetFontSize()                 - Defines the size of the current font.
  ; PDF::SetPageNumbering()            - Set page numbering in footer #True/#False.
  ; PDF::SetInfo()                     - Defines author, titel, subject, creator and associated keywords ('keyword1 keyword2 ...') of the document
  ; PDF::SetLineThickness()            - Defines the line thickness.
  ; PDF::SetMargin()                   - Set left, top, right or cell margin.
  ; PDF::SetPageMargins()              - Set left, top and right page margins.
  ; PDF::SetPosXY()                    - Defines the abscissa and ordinate of the current position.
  ; PDF::SetPosX()                     - Defines the abscissa of the current position.
  ; PDF::SetPosY()                     - Moves the current abscissa back to the left margin and sets the ordinate.
  ; PDF::SubWrite()                    - Write superscripted or supscripted
  ; PDF::TruncateCell()                - Prints a Cell, if text is too large it will be truncated
  ; PDF::Write()                       - This method prints text from the current position.
 
  ; ----- Advanced Commands -----
 
  ; PDF::EmbedFile()                   - Embeds a file into the pdf.
  ; PDF::EmbedFont()                   - Embeds a font into the pdf and returns the font name.
  ; PDF::EmbedJavaScript()             - Add JavaScript
  ; PDF::EmbedJavaScriptFile()         - Include JavaScript file
  ; PDF::EnableFooter()                - Enable/disable Footer (procedure)
  ; PDF::EnableHeader()                - Enable/disable Header (procedure)
  ; PDF::EnableTOCNums()               - Enable/disable adding page numbers to table of contents
  ; PDF::AddEntryTOC()                 - Add TOC entry
  ; PDF::EscapeText()                  - Format a text string (=> masked string).
  ; PDF::GetErrorCode()                - Return the error code.
  ; PDF::GetErrorMessage()             - Return the error message.   
  ; PDF::GetNumbering()                - Return if numbering is #True/#False. Usefull for TOC functions
  ; PDF::GetObjectNum()                - Get object number
  ; PDF::GetScaleFactor()              - Get scale factor for used unit.
  ; PDF::GetWordSpacing()              - Get word spacing. 
  ; PDF::ImageMemory()                 - Puts an image (Memory) in the page.
  ; PDF::InsertTOC()                   - Insert table of contents.
  ; PDF::Link()                        - Puts a link on a rectangular area of the page.
  ; PDF::SetAliasTotalPages()          - Defines an alias for the total number of pages.
  ; PDF::SetColorCMYK()                - Set CMYK color for text, draw and fill (#TextColor / #DrawColor / #FillColor).
  ; PDF::SetEncryption()               - Enable encryption and set passworts and permission
  ; PDF::SetFooterProcedure()          - Set footer procedure.
  ; PDF::SetHeaderProcedure()          - Set header procedure.
  ; PDF::SetOpenAction()               - Set page and zoom for opening the document
  ; PDF::SetPageCompression()          - Enable/disable compression for pages
  ; PDF::SetPageLayout()               - Define display mode for pages in the viewer
  ; PDF::SetPageMode()                 - Define mode and appearance of the viewer (e.g. fullscreen mode)
  ; PDF::SetViewerPreferences()        - Set viewer preferences
  ; PDF::SetWordSpacing()              - Set word spacing.
 
  ; ----- AcroForms [#Enable_AcroFormCommands] ------
 
  ; PDF::ButtonField()                 - Button field (PushButton / CheckBox / RadioButton)
  ; PDF::ChoiceField()                 - Choice field (Scrolling List / ComboBox / editable ComboBox)
  ; PDF::TextField()                   - Text field   (single line/ multiline)
 
  ; ----- Annotations & Actions [#Enable_Annotations] -----
 
  ; PDF::AddFileLink()                 - Defines the page and position for embedded file annotations. (#GraphIcon/#PaperClipIcon/#PushPinIcon/#TagIcon)
  ; PDF::AddGotoAction()               - Goto page and position in the document
  ; PDF::AddGotoLabel()                - Set Label to be able to jump to this position
  ; PDF::AddLaunchAction()             - Defines the page and position for a launch action. (#OpenAction/#PrintAction)
  ; PDF::AddLinkURL)                   - Defines the page and position a link points to and returns its identifier.
  ; PDF::AddTextNote()                 - Defines the page and position for text annotations. ( #CommentIcon/#KeyIcon/#NoteIcon/#HelpIcon/#NewParagraphIcon/#ParagraphIcon/#InsertIcon )
 
  ; ----- Drawing Commands [#Enable_DrawingCommands] -----
 
  ; PDF::DrawCircle()                  - Draws a circle
  ; PDF::DrawEllipse()                 - Draws a ellipse
  ; PDF::DrawGrid()                    - Draws a light blue grid on the page for testing purposes
  ; PDF::DrawLine()                    - Draws a single line between two points.
  ; PDF::DrawRectangle()               - Draws a rectangle.
  ; PDF::DrawRoundedRectangle()        - Draws a rounded rectangle.
  ; PDF::DrawSector()                  - Draws the sector of a circle.
  ; PDF::DrawTriangle()                - Draws a triangle
 
  ; PDF::SetLineCap()                  - Sets the line cap style
  ; PDF::SetLineCorner()               - Sets the line join style.
 
  ; PDF::PathArc()                     - Draws a cubic Bezier curve to the current path.
  ; PDF::PathBegin()                   - Begins a new path at the coordinates (x, y).
  ; PDF::PathEnd()                     - Closes the current path and draws a line from the current point to the starting point.
  ; PDF::PathLine()                    - Draws a line from the current point to (x, y).
  ; PDF::PathRect()                    - Draws a rectangle to the current path with upper-left corner (x, y) and dimensions (w, h).
 
  ; ----- Transformation [#Enable_TransformCommands] -----
 
  ; PDF::StartTransform()              - Use this before calling any transformation. (Scale, Skew, Mirror, Translate)
  ; PDF::StopTransform()               - Restore the normal painting And placing behaviour As it was before calling pdf_StartTransform().
  ; PDF::MirrorHorizontal()            - Alias for scaling -100% in x direction. (Transform)
  ; PDF::MirrorVertical()              - Alias For scaling -100% in y direction. (Transform)
  ; PDF::ScaleHorizontal()             - Scaling horizontal        (Transform)
  ; PDF::ScaleVertical()               - Scaling vertical          (Transform)
  ; PDF::Scale()                       - Scaling                   (Transform)
  ; PDF::SkewHorizontal()              - Skewing -> angle x        (Transform)
  ; PDF::SkewVertical()                - Skewing -> angle y        (Transform)
  ; PDF::Translate()                   - Translate -> right/bottom (Transform)
  ; PDF::TranslateHorizontal()         - Translate -> right        (Transform)
  ; PDF::TranslateVertical()           - Translate -> bottom       (Transform)
 


Download: 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]


Last edited by Thorsten1867 on Tue Aug 27, 2019 12:15 pm, edited 6 times in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Thu Jan 03, 2019 8:49 pm 
Offline
PureBasic Team
PureBasic Team
User avatar

Joined: Fri Apr 25, 2003 6:14 pm
Posts: 1701
Location: Germany (Saxony, Deutscheinsiedel)
Looks very powerful! Thank you very much :D

Hint: You should change the first line in your example codes to the following, as they are placed in a sub-folder "Examples", while the include file is in the parent drawer:
Quote:
XIncludeFile "../pbPDFModule.pbi"

_________________
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Mon Jan 07, 2019 8:43 pm 
Offline
Addict
Addict
User avatar

Joined: Sun Nov 05, 2006 11:42 pm
Posts: 4502
Location: Lyon - France
Thanks a lot for sharing this usefull works 8)

_________________
ImageThe happiness is a road...
Not a destination


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Fri Jan 18, 2019 5:48 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
Added:
Password Protection & Encryption
Access permissions for PDF documents

_________________
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] pbPDF-Module
PostPosted: Wed Jan 23, 2019 7:44 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 14, 2014 12:09 pm
Posts: 233
Problem when reading a file created with your programm :
Error message
Code:
Error when reading this file 14

Environement :
Compiling with Purebasic 70 X86 version
Reading with Adobe acrobat reader version 20
Windows 10


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Wed Jan 23, 2019 8:07 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
I created a new (hopefully error-free) ZIP file for download.

_________________
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] pbPDF-Module
PostPosted: Wed Jan 23, 2019 11:03 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 14, 2014 12:09 pm
Posts: 233
PDF::AddLaunchAction
doesn't work in your example PbPDF-Actions.pb ligne 26
respond
Quote:
Code:
can't open file 20k_C2.txt

In PBpdf_Pagesformat.pb
Ligne 30 error message Module element GetPageHeigth unkown


Last edited by loulou2522 on Wed Jan 23, 2019 11:21 am, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Wed Jan 23, 2019 11:20 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
Which PDF viewer did you use? Some don't seem to support all file types.



Gesendet von meinem Aquaris X2 mit Tapatalk

_________________
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] pbPDF-Module
PostPosted: Wed Jan 23, 2019 11:26 am 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 14, 2014 12:09 pm
Posts: 233
Acrobat Reader DC v 20


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Wed Jan 23, 2019 12:19 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
I'll test it at home.

Gesendet von meinem Aquaris X2 mit Tapatalk

_________________
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] pbPDF-Module
PostPosted: Wed Jan 23, 2019 12:59 pm 
Offline
Enthusiast
Enthusiast

Joined: Tue Oct 14, 2014 12:09 pm
Posts: 233
I find the errror in your programm PB_pdf_Pageformat.pb

Ligne 30, 34 and 38 GetPageHeight is uncorrectly written
PDF::Cell(#PDF, StrF(PDF::GetPageWidth(#PDF), 0) + "x" + StrF(PDF::GetPageHeigth(#PDF), 0) + " mm", 40, 10, #True)

instead of
PDF::Cell(#PDF, StrF(PDF::GetPageWidth(#PDF), 0) + "x" + StrF(PDF::GetPageHeight(#PDF), 0) + " mm", 40, 10, #True)

For the launching of file i can't solve it


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Wed Jan 23, 2019 3:18 pm 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
loulou2522 wrote:
PDF::AddLaunchAction
doesn't work in your example PbPDF-Actions.pb ligne 26
respond
Quote:
Code:
can't open file 20k_C2.txt

In PBpdf_Pagesformat.pb
Ligne 30 error message Module element GetPageHeigth unkown


It works for me.
Probably the file type (*.txt) is not linked to any program.

_________________
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] pbPDF-Module
PostPosted: Tue Feb 05, 2019 3:37 pm 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 610
This looks great, can it be used to join existing pdf files?


Top
 Profile  
Reply with quote  
 Post subject: Re: [Module] pbPDF-Module
PostPosted: Wed Feb 06, 2019 8:53 am 
Offline
Addict
Addict
User avatar

Joined: Wed Aug 24, 2005 4:02 pm
Posts: 892
Location: Germany
Unfortunately this is not possible, you can only create your own PDF documents.
You need a tool like "pdftk".

_________________
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] pbPDF-Module
PostPosted: Wed Feb 06, 2019 9:42 am 
Offline
Enthusiast
Enthusiast

Joined: Sat Apr 26, 2003 2:49 pm
Posts: 610
Ok thanks.


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

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 17 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