pdfapi2-users Mailing List for PDF::API2
Status: Beta
Brought to you by:
areibens
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2014 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Shivam M. <shi...@ho...> - 2014-10-20 23:09:17
|
Hello Gurus, I am looking for help in printing data from an SQL Select query into PDF using PERL. Here is my code and it writes only ‘1’ in the PDF instead of actual country code. Please advise. My requirement is to print each country code in the record set on a new page in PDF. use PDF::Create ; use DB ; use DBI ; use Time::Format ; # qw(%time %strftime %manip); use POSIX qw(strftime) ; print "Timestamp: $time{'yyyymmdd.hhmmss.mmm'}\n" ; my $ fileTime = $ time { 'yyyymmdd.hhmmss.mmm' }; # initialize PDF my $ filename_path = "C:\\Project\\Perl_Workspace\\" ; my $ file_name ; $ file_name = "Test_PDF_Image_Print_" . $ fileTime ; my $ file_format = ".pdf" ; my $ dest_file = $ filename_path . $ file_name . $ file_format ; my $ pdf = PDF::Create -> new ( 'filename' => $ dest_file , 'Author' => 'PerlNewB' , 'Title' => 'Sample PDF' , 'CreationDate' => [ localtime ], ); # add a A4 sized page my $ a4 = $ pdf -> new_page ( 'MediaBox' => $ pdf -> get_page_size ( 'A4' )); # Add a page which inherits its attributes from $a4 my $ page = $ a4 -> new_page ; # Prepare a font my $ f1 = $ pdf -> font ( 'BaseFont' => 'Helvetica' ); # Prepare a Table of Content my $ toc = $ pdf -> new_outline ( 'Title' => 'Title Page' , 'Destination' => $ page ); # Connect to Oracle Database and return data using a query and store it in a variable my $ user = "user1" ; my $ password = "password1" ; my $ v_data ; my $ db = DBI -> connect ( "dbi:Oracle:ORA1" , "$user" , "$password" ) || die ( $ DBI::errstr . "\n" ); $ db ->{ AutoCommit } = 0 ; $ db ->{ RaiseError } = 1 ; $ db ->{ ora_check_sql } = 0 ; $ db ->{ RowCacheSize } = 16 ; my $ SEL = "select Country_code from country where rownum<100" ; my $ ctr = 1 ; my $ ctr1 = 1 ; while ( $ ctr < 10 ) { # include a jpeg image with scaling to 20% size my $ jpg = $ pdf -> image ( "C:\\Users\\user1\\Pictures\\image1.jpg" ); $ page -> image ( 'image' => $ jpg , 'xscale' => 0 . 2 , 'yscale' => 0 . 3 , 'xpos' => 50 , 'ypos' => 810 ); ####Printing Database Values On PDF#### my $ sth = $ db -> prepare ( $ SEL ); $ sth -> execute (); while ( my @ row = $ sth -> fetchrow_array () ) { $ v_data = @ row ; print $ v_data ; $ page -> stringc ( $ f1 , 20 , 306 , 300 , $ v_data ); } $ sth -> finish (); # Add another page my $ page2 = $ a4 -> new_page ; $ jpg = $ pdf -> image ( "C:\\Users\\mathus01\\Pictures\\BOTW 3x1 lockup.jpg" ); $ page2 -> image ( 'image' => $ jpg , 'xscale' => 0 . 2 , 'yscale' => 0 . 3 , 'xpos' => 50 , 'ypos' => 810 ); $ ctr ++; } $ pdf -> close ; END { $ db -> disconnect if defined ( $ db ); } Thank you! |
From: <ben...@id...> - 2004-05-25 11:07:04
|
Dear Open Source developer I am doing a research project on "Fun and Software Development" in which I kindly invite you to participate. You will find the online survey under http://fasd.ethz.ch/qsf/. The questionnaire consists of 53 questions and you will need about 15 minutes to complete it. With the FASD project (Fun and Software Development) we want to define the motivational significance of fun when software developers decide to engage in Open Source projects. What is special about our research project is that a similar survey is planned with software developers in commercial firms. This procedure allows the immediate comparison between the involved individuals and the conditions of production of these two development models. Thus we hope to obtain substantial new insights to the phenomenon of Open Source Development. With many thanks for your participation, Benno Luthiger PS: The results of the survey will be published under http://www.isu.unizh.ch/fuehrung/blprojects/FASD/. We have set up the mailing list fa...@we... for this study. Please see http://fasd.ethz.ch/qsf/mailinglist_en.html for registration to this mailing list. _______________________________________________________________________ Benno Luthiger Swiss Federal Institute of Technology Zurich 8092 Zurich Mail: benno.luthiger(at)id.ethz.ch _______________________________________________________________________ |
From: Oturan B. <otu...@ho...> - 2004-02-27 10:25:35
|
I like to use pdf::api2 to write document metadata into pdfs. I have succeeded in doing this for the title,author,etc fields that are already defined and in the pdf. However it does not work for custom fields. Since those fields are not in the pdf, they have to be created first so api2 can write to them. I have done a quick dirty hack and modified the main pdf api2 .pm file, and added the name of the custom fields in the if-then structures. This seems to work, and it will do what I want, granted that the set of custom fields is well defined (previously known) What must I do in order to create custom fields on the fly from pdf::api2? Please advise, Thanks a bunch, -Oturan Boga _________________________________________________________________ The new MSN 8: smart spam protection and 2 months FREE* http://join.msn.com/?page=features/junkmail |
From: Ramm, H. <Hen...@me...> - 2003-10-28 13:05:00
|
Hello list, I'm trying to combine some single page PDFs to one new multi-page PDF. There should be a bookmark (outline) linking to every single page. I found out, that combining pages works only if I - set $pdf->{forcecompress} (undocumented, guessed from example) if I omit that, I get only errors - open the collected file, import one page, save it. If I try to import several pages, they get corrupted. Regarding bookmarks: - bookmarks of existing files don't get imported with their page - I didn't manage to writ emore than one bookmark to my new file, if I try to write the second, it can't find its "outline" method. I'd like to know how to read information from existing files, e.g. all the boxes, bookmarks etc. I tried to walk through all objects of a PDF objects, but didn't find what I was looking for. Any hints? Here's my (simplified) code: ------------------------------------------- #!/usr/bin/perl -w use warnings; use strict; use PDF::API2; my $Page =3D 0; my $Filepattern =3D 'Page-###-Date.pdf'; my $Targetfile =3D 'Everything-Date.pdf'; my $Workdir =3D "D:/temp/"; # we're on Windows! $Targetfile =3D $Workdir.$Targetfile; my $CompletePDF =3D PDF::API2->new(-file =3D> $Targetfile); $CompletePDF ->{forcecompress} =3D 0; # why? my $Bookmark =3D $CompletePDF->outlines; $CompletePDF ->saveas($Targetfile); $CompletePDF ->end(); my $ok =3D 1; while ($ok) { $Page =3D sprintf "%03u", ++$Page; my $File =3D $Workdir.$Filepattern; $File =3D~ s/###/$Page/; if (-f $File) { # while file exists my $SinglePDF =3D PDF::API2->open($Datei); $SinglePDF->{forcecompress} =3D 0; =09 $CompletePDF =3D PDF::API2->open($Targetfile); $CompletePDF->{forcecompress} =3D 0; $Bookmark =3D $CompletePDF->outlines my $NewPage =3D $CompletePDF->importpage($SinglePDF, 0); =09 #$Bookmark =3D $Bookmark->outline; # can't find outline method after first page! #$Bookmark->title("Page $Page"); #$Bookmark->dest($NewPage, -fith =3D> 1360); $CompletePDF->saveas($Targetfile); $CompletePDF->end(); $SinglePDF->end(); } else { $ok =3D 0; } # no more pages } # while $CompletePDF =3D PDF::API2->open($Targetfile); $CompletePDF ->{forcecompress} =3D 0; my %Info =3D $CompletePDF->info; $Info{Title} =3D "S=FCdkurier"; $CompletePDF->info(%Info); $CompletePDF->preferences( -outlines =3D> 1, -firstpage =3D> [ $CompletePDF->openpage(1), -fith =3D> 1360 ] ); $CompletePDF->saveas($Targetfile); $CompletePDF->end(); --------------------------------------------- --=20 Gr=FC=DFe vom Bodensee! Henning Hraban Ramm S=FCdkurier / MediaPro Abt. Systementwicklung |