[PB 5.72 x64] - export to PDF question ...

Everything else that doesn't fall into one of the other PB categories.
marc_256
Enthusiast
Enthusiast
Posts: 743
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

[PB 5.72 x64] - export to PDF question ...

Post by marc_256 »

[PB 5.72 x64]
Windows 10 x64

Hello,

For my sub program CAD / ELECTRIC SCHEMES drawing and first tests (see image below),
I want to export the screen drawing data to a PDF file ... MyFile.pdf

For that I want to use the pbPDFModule.pbi (thanks Thorsten1867)
or are there better solutions for [pb5.72x64] win 10 ?

Page : A4 = 297x210 mm
Form : Landscape
Color : Black/white
DrawingData : standard PB 2D Library

What is the best way to do this ?
1) export as lines, arcs, circles and text ...
2) pre-drawing all on a image and export as pdf image ...


Thanks,
marc

Image
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
juergenkulow
Enthusiast
Enthusiast
Posts: 544
Joined: Wed Sep 25, 2019 10:18 am

Re: [PB 5.72 x64] - export to PDF question ...

Post by juergenkulow »

Try PB 6.10 Beta 6 Windows
PLC_Stuff.pdf

Code: Select all

; PdfVectorOutput Windows PB 6.10 Beta 6 
UsePNGImageDecoder()
UsePNGImageEncoder()
PLC=LoadImage(#PB_Any,"D:\PLC_Stuff.png")
If StartVectorDrawing(PdfVectorOutput("D:\PLC_Stuff.pdf",297,210,#PB_Unit_Millimeter))
  MovePathCursor(0, 0)
  DrawVectorImage(ImageID(PLC),$ff,297,210)
  StopVectorDrawing()  
EndIf
normeus
Enthusiast
Enthusiast
Posts: 414
Joined: Fri Apr 20, 2012 8:09 pm
Contact:

Re: [PB 5.72 x64] - export to PDF question ...

Post by normeus »

I think it would look nice if you created the image in memory then loaded the image to a page using pbPDF image from memory command:

Code: Select all

;Definition
PDF::ImageMemory(ID.i, ImageName.s, *Memory, Size.i, Format.i, X.f=#PB_Default, Y.f=#PB_Default, Width.f=#PB_Default, Height.f=#PB_Default, Link.i=#NoLink)
Norm.
google Translate;Makes my jokes fall flat- Fait mes blagues tombent à plat- Machte meine Witze verpuffen- Eh cumpari ci vo sunari
moricode
User
User
Posts: 93
Joined: Thu May 25, 2023 3:55 am

Re: [PB 5.72 x64] - export to PDF question ...

Post by moricode »

That is two method what you can do with CAD to PDF :

Method 1 :
Draw everything to a PNG/JPG image , and then use pbPDFModule.pbi to put/Embed the image inside the PDF and save.
This method will save the CAD as raster image and not good to enlarger print/view.
just to take care the pbPDFModule.pbi has some pros and cons

Method 2 :
Insert all the CAD entity/element (LINE/ARC/CIRCLE/TEXT/ELIPSE/POLYLINE/LWPOLYLINE...) as PDF path and stroke with color and lineweigth , this method will let you print sharp and clear CAD draw in larger format like A0 size without any problem.
but pbPDFModule.pbi can't do a real ARC function , because PDF native path use LINE and Bezier only.


i do need this CAD to PDF things , so i take Method 2 and modified large code from pbPDFModule.pbi , so far it is ok for me to draw path from CAD.
moricode
User
User
Posts: 93
Joined: Thu May 25, 2023 3:55 am

Re: [PB 5.72 x64] - export to PDF question ...

Post by moricode »

for Method 1 , the PDf file size is very big , normally 200K to 1M , 2M , depend on the raster image


for method 2 , the file size is small , normally is between 20K to 200K depend on drawing elements.
moricode
User
User
Posts: 93
Joined: Thu May 25, 2023 3:55 am

Re: [PB 5.72 x64] - export to PDF question ...

Post by moricode »

and if you use Method 2 , just be careful , as the PDF (x,y) origin is at TOP LEFT , and CAD WCS coordinate origin (x,y) is at BOTTOM LEFT , so you have to mirror y axis , and some more you need to check the bounding box of CAD element and scale it to fit to PDF page size designated .

and you need to do some DTP point size to metrics mm size or vice versa , since PDF only use DTP point size for all length measurements.
marc_256
Enthusiast
Enthusiast
Posts: 743
Joined: Thu May 06, 2010 10:16 am
Location: Belgium
Contact:

Re: [PB 5.72 x64] - export to PDF question ...

Post by marc_256 »

@juergenkulow
Try PB 6.10 Beta 6 Windows
Sorry, but for me, PB5.72x64 is the best graphic compiler till today ...


@normeus
Yes, I think I gone use that way ...
First create it locally and then export it as a png image.


@moricode
Thanks for your answers and tips,

I don't need to scale the PDF file drawing,
as it is always on a A4 page in landscape direction.
And it is Black/White.
And also 150 DPI is good an of for this CAD application -> pdf.


Thanks,
Marc
- every professional was once an amateur - greetings from Pajottenland - Belgium -
PS: sorry for my english I speak flemish ...
Post Reply