Pdftogerber
Pdftogerber
http://swannman.wordpress.com/projects/pdf2gerb/
scattershot genius;
Matt Swann on photography, electronic design, and other miscellany
Blog
Projects
Photos
About
RSS
Me
Worthy
1 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
plotter flash commands). Each white circle in the PDF artwork is converted to a correctly-sized drill command in the NC Drill file.
An example
Here is a board I designed in Illustrator, converted to Gerber using the pdf2gerb script, and sent off for printing to BatchPCB:
To accomplish this, I did the following: 1. Did a rough layout of the sketches by hand on graph paper 2. Transferred the sketches into properly-dimensioned layouts in Illustrator Created several layers: Top Copper, Bottom Copper, Top Silkscreen, Soldermask, and Drill. Drew holes in the drill layer as a solid black circle (for the pad) with a solid white circle on top (for the drill location and diameter) Used the pen tool on the Top and Bottom layers to connect pads with appropriately-weighted traces Drew solid black circles in the Soldermask layer to cover each pad Drew a rectangle around the board in the Silkscreen layer 3. Copied the Drill layer into both top and bottom layers (which may not have been necessary) 4. Saved the document as a copy in PDF format Selected PDF 1.3 format Unchecked Preserve Illustrator Editing Capabilities Unchecked Embed Page Thumbnails
Follow
2 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
On the Compression page, unchecked Compress Text and Line Art 5. Ran pdf2gerb.pl /path/to/circuit.pdf 6. Renamed Top Copper.drd to Drill.drd 7. Made a .zip file of Top Copper.grb, Bottom Copper.grb, Top Silkscreen.grb, Soldermask.grb, and Drill.drd 8. Submitted the .zip file to BatchPCB You can download a .zip containing the files from each step here.
49 Comments
1. step great! i understand why curved beziers are a problem, but arent circles from illustrator beziers as well? anyway. i waited for something like this and will soon test it. wonderful its pearl, and even better its os x by default :-) best regards, step
Follow
3 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
2. svo This is awesome, but you made me really curious why did you specifically want to design this one in Illustrator and not use a CAD/CAE tool to design it? There are free, there are cheap EE tools like KiCad, FreePCB or Eagle? 3. Matt Swann @step: Yep, circles are bzier paths but they translate into a single Gerber command that just takes the radius and position. Much easier than stepping through a polynomial function to determine what the path looks like (though it wouldnt be burdensome to add). @svo: The motivation to use Adobe Illustrator is threefold. First, Ive already spent the time to learn its user interface some of the CAD apps I looked at were particularly unintuitive. Second, I use Mac OS X, and that significantly limits the number of PCB applications available to me. Finally, the free apps that I found either fell into the unintuitive bucket or had a board size restriction that wouldnt work for my application. As a hobbyist, it was important for me to get from paper to board quickly and cheaply. It only took a couple of hours to write this script (after Id learned the PDF and Gerber grammars), and I learned much in the process. 4. Russell Nelson This is kinda cool, but a program like pcb for Linux does this out of the box. Open source, no limitations. But I guess its more fun to use a Mac! :-) 5. Matt Swann Russell, I have PCB (and the rest of the gEDA suite) on my Mac, but I couldnt abide its UI. Since producing PCBs isnt something Ill do often, I had a hard time convincing myself that overcoming the learning curve was worth the effort. The idea here is to free hobbyists and artists from learning a new CAD app and allow them to use a vector art tool of their choice. 6. svo Thanks Matt, that sounds reasonable enough to me :) And I agree that gEDA is unbearable and should not exist. Great work! 7. Matt Swann svo: And I agree that gEDA is unbearable and should not exist. LOL, though I wouldnt go quite that far. Its a strong suite, it just needs some usability enhancements!
Follow
4 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
8. step @matt: so if beziers other than circles are possible, pleaaaaase go that way or hint me in the right direction. i gotta send you a one of my pcb designs. i didnt finish them because they were unproducable being done in illustrator. beziers would be the killing feature for pdf2gerb ! and one reason for not using anything else than illustrator to do board design at least for me anyway great great work //step 9. Matt Swann You might be able to work around the lack of bzier curve support by approximating the curve with straight lines eg instead of a smooth curve, make it using 8-10 straight segments. If you were to add bzier curve support to pdf2gerb, the Adobe PDF documentation has the function that youd use. Plug the numbers from the curve into the formula, then iterate through the function to get (x,y) coordinates and plot them out. 10. Jose Hidalgo Hi Matt. Like other people, I have some trouble running this useful script on OS X (10.3.9). The script seems to work for 1-2 seconds, then nothing happens and theres no output at all. Heres what my Terminal shows in debug mode (as you will see there are no weird file paths, and something seems to happen on line 82 but its not considered as an error ?) : Last login: Thu Dec 27 01:44:22 on ttyp1 Welcome to Darwin! [iMac-G4-Jose:~] joe% cd /Users/joe/Desktop [iMac-G4-Jose:~/Desktop] joe% perl -d pdf2gerb.pl /Users/joe/Desktop/pdf2gerb /desym.pdf Loading DB routines from perl5db.pl version 1.22 Editor support available. Enter h or `h h for help, or `man perldebug for more help. main::(pdf2gerb.pl:24): @apertures = (); DB s main::(pdf2gerb.pl:27): @drillApertures = (); DB main::(pdf2gerb.pl:30): @layerTitles = (); DB main::(pdf2gerb.pl:33): $scaleFactor = 0.0138888889;
Follow
5 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
DB main::(pdf2gerb.pl:36): $maxBytes = 5 * 1024 * 1024; # 5 MB DB main::(pdf2gerb.pl:38): if (@ARGV != 1) main::(pdf2gerb.pl:39): { DB main::(pdf2gerb.pl:45): $pdfFilePath = $ARGV[0]; DB main::(pdf2gerb.pl:48): $pdfFilePath =~ /^(.+)\/.+$/; DB main::(pdf2gerb.pl:51): if ($1 eq ) main::(pdf2gerb.pl:52): { DB main::(pdf2gerb.pl:57): $outputDir = $1 . /; DB main::(pdf2gerb.pl:61): open pdfFile, < $pdfFilePath; DB main::(pdf2gerb.pl:64): read(pdfFile, $rawPdfContents, $maxBytes); DB main::(pdf2gerb.pl:67): @rawLines = split /(\r\n|\n\r|\n|\r)/, $rawPdfContents; DB main::(pdf2gerb.pl:68): chomp(@rawLines); DB main::(pdf2gerb.pl:69): $pdfContents = join(\n, @rawLines); DB main::(pdf2gerb.pl:70): $pdfContents =~ s/\r//gs; DB main::(pdf2gerb.pl:71): $pdfContents =~ s/\n\n/\n/gs; DB main::(pdf2gerb.pl:74): while ($pdfContents =~ /\/Title\((.+?)\)/gs) { DB main::(pdf2gerb.pl:79): $currentLayer = 0; DB main::(pdf2gerb.pl:82): while ($pdfContents =~ /BDC(.*?)EMC/gs) { DB Debugged program terminated. Use q to quit or R to restart, use O inhibit_exit to avoid stopping after program termination, h q, h R or h O to get additional info. DB Many thanks in advance for your help. Best regards. Jose 11. Matt Swann Jose, I sent you an email if you feel comfortable sharing the PDF file youre importing, I can take a look and maybe help debug this. My initial guess is that
Follow
6 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
there are no BDC..EMC blocks in the PDF file perhaps it was saved in a compressed format? 12. Andrew Jukes Hi Matt I am wondering if you were able to sort out Joses problem as I think I have hit the same one. Saving my pcb design from Illustrator 12.0.1 and following your step by step instructions doesnt seem to produce a file with BDC..EMC blocks, so pdf2gerb wont work. I am running MacOS 10.4.11. The script is a great idea. Hope you can help me as at the moment I cant see any other way forward. Regards Andrew 13. Matt Swann Andrew, The most common reason for this to happen is forgetting to uncheck Compress Text and Line Art in the PDF export dialog could you double-check that this is off when youre doing the export? Im also using Illustrator 12.0.1. Alternatively, if youd like to share the .ai file I can give it a go to make sure it exports fine whatever youre comfortable with. 14. Matt Swann Andrew, I poked around your .ai file a bit I was able to repro the issue with no BDC/EBC blocks appearing in the PDF output. It turns out that there are several Live Paint Groups in the file when I deleted these, I was able to save a working PDF file. Looks like these groups used transparency (?) and were causing the PDF writer to flatten the entire document into one layer before saving. I was able to save the document in PDF 1.5 or 1.6 format and check the create top-level layers box to create proper-looking layers without deleting these groups, but I didnt try converting the resulting document to Gerber. It would probably work fine, but no guarantees 15. derick Ive been using Illustrator 10 under Wine on Linux for quite some time. I use it successfully when desingning DXF and eps files for 3d and prototyping. Its a great
Follow
7 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
desing tool! I was happy to find something that helps Illustrator work for PCB design as well! However, while trying to run the script on Ubuntu Linux i have not been able to achieve correct results. There are no error messagesThe files are created, but gerbviewer shows inaccurate results (I can send files for review) Is it possible that I need a newer Illustrator version to work on the designs ? Has anyone been successful with Illustrator 10 for PC? Thanks guys! Derick 16. Donald Delmar Davis Eagle 5 is native to osx and creates gerbers just fine. 17. Matt Swann Indeed it does, but the UI is atrocious. I tried it and figured there had to be a better way where better is defined as using vector drawing tools Im already familiar with. 18. Michael Fleming This is terrific. I use CorelDraw to quickly design RF, analog, and digital boards. Then I send them out to a gerber conversion house as eps. I can quickly do things in CorelDraw that would be very difficult in PCB CAD. I will try and use this to eliminate the conversion house Thank You! 19. Matt Swann Youre welcome and good luck! 20. safir I have a pdf with the following format Creator: Adobe InDesign CS2 (4.0.5) Producer: Adobe PDF Library 7.0 Security: No Format: PDF-1.4 Optimised: Yes and i wish to achieve the same convert it to gerber data files. Can any one please tell me how to go about it. 21. Richard Bonomo I am attempting to use this with EasyDraw and TurboCad for Mac OS 10. I think EasyDraw is pretty much a flat-PDF only system when it exports (though it does PDF v. 1.3. TurboCad can export what appears to be a non-flat, non-compressed ASCII PDF file, though in version 1.4. I am working with a very simple drawing to test the concept. May I send you the TurboCAD-generated PDF to see if there is some way I
Follow
8 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
could make this work? 22. Linus Could you please teach me how I can run pdf2gerb in Windows XP? Its reall a good tool. I am just wondering if someone can write a program to convert ai file to gerber file. Then I find this website. But I am using Windows XP and I have a problem to use it. Please help. Thanks a lot. 23. Matt Swann Note: I worked with Richard to get pdf2gerb working with TurboCAD, per his comment above. The result is pdf2gerb 1.2, which supports stroked circles and is compatible with his TurboCAD output. 24. Urvish Ok Im new to mac so please bear with me. I dled the file and got the file to mount to an exectutable although i had to leave out the .pl. If i double click on pdf2gerb it opens a terminal window and says: Last login: Wed Mar 25 18:46:23 on ttys001 /Users/urvishkumbhani/Desktop/pdf2gerb ; exit; urvish-kumbhanis-macbook-pro:~ urvishkumbhani$ /Users/urvishkumbhani /Desktop/pdf2gerb ; exit; usage: pdf2gerb logout [Process completed] The file i want to convert in on my desktop in a folder called attachments. how do i convert it? Typing what you said in the instruction does nothing but give an error saying file does not exists. What do i type, and where, in a new terminal window or in the one that the pdf2gerb opens when i click on it? 25. Vicky I would truly like to be able to use this application, but I have tried to use chmod 755 pdf2gerb.pl to mark the file as an executable file and it does not work. I add the extension exe to the file and type pdf2gerb/path/to/circuit.pdf and it seems to be trying to do something, but it works for hours with no resulting gerber files. It does not end and may not be working at all. Can you help? 26. Matt Swann @Urvish, Vicky try this: - Download pdf2gerb to your Desktop (dont rename it) - Find the PDF youd like to convert and copy it to your Desktop - Open the Terminal app from Applications -> Utilities
Follow
9 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
- Type cd Desktop (without the quotes) and hit enter - Type pdf2gerb thenameofyourfile.pdf and hit enter (note the space between pdf2gerb and the filename) Let me know if that works for you. Cheers! 27. Urvish Ok tried it again with a fresh dl of pdf2gerb,, idnot rename. This is what i get: Last login: Mon Mar 30 09:15:06 on ttys000 urvish-kumbhanis-macbook-pro:~ urvishkumbhani$ cd desktop urvish-kumbhanis-macbook-pro:desktop urvishkumbhani$ pdf2gerb attachments/bar.pdf -bash: pdf2gerb: command not found urvish-kumbhanis-macbook-pro:desktop urvishkumbhani$ also tried it with the original renamed program and same problem? Any more suggestions? I have a job that came in so i need to find a way to convert this ASAP. Thanks for the help so far. 28. Randall Did anyone ever find out if the pdf2gerb (1.2) script will work and how it would work with Windows XP?? Thanks in advance for any information on this subject. 29. Linus Hello Randall, About running pdf2gerb in Windows XP, I have found one way. 1. Download Activeperl and install it http://www.activestate.com/activeperl/ 2.In the Command window (start\run\cmd), run pdf2gerb as: C:\Temp\Perl pdf2gerb.pl Circuit.pdf 3.If you would like to edit the script, there is a convenient tool Notepad++ http://notepad-plus.sourceforge.net/tw/site.htm 30. Steve Wida I dont have Adobe Illustrator, but I do have the ability to pint to a .pdf file from my PCB layout software (Each layer would be in a single .pdf file). Is there a way to convert a single pdf. to a Gerber file using pdf2gerb? BTW: I am running this on Windows XP using ActiveState. http://www.activestate.com/activeperl 31. Matt Swann
Follow
10 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
@Steve many PCB software packages also produce Gerber output. Thats likely to be a better route than pdf2gerb for this case. If you still want to give pdf2gerb a try, make sure that the PDF output from your PCB software is in an uncompressed format (looks like lines of text when you open it in Notepad) and that your drill holes are represented as white filled circles atop black filled circles. 32. Mark Kupferberg Can this script be used to convert PDFs created from scans of mylar PCB fabrication drawings into gerber files? Any other ideas to doing this kind of conversion? 33. Matt Swann @Mark probably not, as Im guessing the PDF output from the scanner is a bitmap image rather than vector line art. Eg if you zoom way in, it looks jaggy rather than smooth right? 34. atk I have a pdf with the following format Creator: Adobe inlustrator CS2 Producer: Adobe PDF Library 7.0 Security: No Format: PDF-1.4 Optimised: Yes Mac osx 10.5 I do that Download pdf2gerb to your Desktop (dont rename it) - Find the PDF youd like to convert and copy it to your Desktop - Open the Terminal app from Applications -> Utilities - Type cd Desktop (without the quotes) and hit enter - Type pdf2gerb thenameofyourfile.pdf and hit enter (note the space between pdf2gerb and the filename) But it dont found pdf2gerb. you can help me please???. Can any one please tell me how to go about it. I can design on inlustrator. Thank you very much! 35. T. Aldoorn In the past we used Coreldraw fo design of PCBs, but firm to make the PCBs does noe excist aymore.The companies who make PCBs require Gerber data. Can you make an offer for a program to convert Coreldraw intoe Gerber? 36. Denis I am trying to do something slightly different.I have scanned a single pcb artwork (one copper layer) to pdf.the resulting image is not perfect.Can I use pdf2gerb to convert this directly from pdf to gerber,so as I can read the gerber into my cam software for rework.Is this possible and if not,does anyone know of any software
Follow
11 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
that will convert scanned images of pcb layers to gerbers,or import the image and export gerber or dxf. 37. Wilson Hello Matt, Ive tried using your script to convert a pdf into a gerber but this is the only outcome Im getting in the generated .grb files: %FSLAX24Y24*% %MOIN*% %ADD10C,0.01389*% G01* G54D10* M02* Any ideas on what might be the problem? Thank you Matt Swann Wilson, could you post the PDF youre converting? 38. Thomas I have tried to use this script, and for the most part it appears to be working. But there are three things that I have found problems with. Firstly the drd files. You say to use the one for the Top layer, but this seems to have lots of obscure drill sizes in it. any suggestions? Secondly, square pads for SMD components are converted, but appear in stange positions when i view the Gerber file. And finally, it appears that polygon objects such as copper fill areas are not converted. Any suggestions on this? Any help would be muchly appreciated. Tom Matt Swann Hi Tom, Great questions. pdf2gerb doesnt officially support polygons or rectangular pads, unfortunatelyjust lines (straight or bezier) and circles. Depending on how unsupported elements appear in the PDF file, theyll either be skipped or misinterpreted as other things. Ill probably get around to supporting these at some point, but with a new baby in the house I cant say when that will be. Re: the drill sizes pdf2gerb doesnt make any attempt to snap to well-known drill sizes it looks at the circle that represents the drill hole and uses that diameter verbatim. Do the sizes match up to what youre seeing in the PDF?
Follow
12 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
Let me know if theres any other info that I can provide. Matt 39. Jagadish Dear Matt, I am getting the same result on all pdf files, I am using..it is like following.. This is the same problem as Mr. Wilson had faced.. %FSLAX24Y24*% %MOIN*% %ADD10C,0.01389*% G01* G54D10* M02* Can me help me out? - Jagadish Matt Swann I followed up with Jagadish via email there are several reasons why his PDF doesnt convert properly with pdf2gerb: its a compressed PDF, eg its not plain text when you look at it with a text editor it wasnt designed for pdf2gerb. pdf2gerb doesnt support area fills or text and has a specific format for drill circles. 40. Koustubh Sinkar Why dont you upload your project on sourceforge.net or any other code hosting site, so that we can also contribute to the project 41. rcr Hello, I am using Windows XP and have not been able to make the file executable to run it. Does it only work with Linux? Matt Swann The script only works on Linux and Mac OS X. It may work on Windows under Cygwin, but I havent tried it. 42. David Some questions about pcb2gerb The program made a grb file from a pdf of a top copper layer, however 1) Even though the file looks OK in a word processor, and gerbv program finds
Follow
13 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
traces and says no errors: a) No gerber viewer program will display the file I tried gerbv, GerberLogix, and another one b) there is no drill file, even though the pads and holes seem clear in the pdf. Guesses about the problems: a) the file is too long b) something not quite right in the pdf save settings Any suggestions would be appreciated. 43. jorbedo Matt, thanks for sharing this script. Any specific layer names? ie. Layer3 = Soldermask Layer2 = Drill Layer1 = Traces Thanks Matt Swann Thanks! No, specific layer names are not required. I output a trace file for every layer I find if it has traces a soldermask is just a special case of a trace layer and a drill file for every layer where I find drill holes. The output files share the layer names. 44. jorbedo Matt, how can I do rectangles, the pins of the connector on my project are rectangular, instead of capsules (What I got so far) on the PDF they look perfect but not on the grb file. Thanks
Leave a Reply
Enter your comment here...
Guest
Log In
Log In
Log In
Follow
14 de 15
28/09/11 23:04
http://swannman.wordpress.com/projects/pdf2gerb/
(Not published)
Post Comment
Follow
15 de 15
28/09/11 23:04