Hi, I have a little issue here. I''m working on an eBook site and need to generate PDFs. I managed it using PDF::Writer and did the trick quite well but now I want to generate PDFs with a password access. After checking on internet, I saw that PDF::Writer encrypt method was removed (for encryption algorithm was cracked or something like that). Had a look at the Prawn plugin but it has no security module and can''t be used to do so. Is there any way to create password protected PDFs with Ruby? Other problem, I want to modifiy the PDF generation to create new PDFs by copying PDF files already existing and adding a front page with the customer name and a little message. I managed read PDF files and copy the content in a new PDF but I''m losing all the format (the result is just a new PDF with the text of the original PDF but with no format...). Anyone know how I can copy a PDF and add this front page? Thanks for your help, Olivier. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Oliver, On Fri, 2009-02-20 at 11:09 -0800, CiriusMex wrote:> Hi, I have a little issue here. I''m working on an eBook site and need > to generate PDFs. I managed it using PDF::Writer and did the trick > quite well but now I want to generate PDFs with a password access. > After checking on internet, I saw that PDF::Writer encrypt method was > removed (for encryption algorithm was cracked or something like that). > Had a look at the Prawn plugin but it has no security module and can''t > be used to do so. > > Is there any way to create password protected PDFs with Ruby? > > Other problem, I want to modifiy the PDF generation to create new PDFs > by copying PDF files already existing and adding a front page with the > customer name and a little message. I managed read PDF files and copy > the content in a new PDF but I''m losing all the format (the result is > just a new PDF with the text of the original PDF but with no > format...). Anyone know how I can copy a PDF and add this front page?I worked through a very similar set of issues a couple of years ago. Ended up using a system call to pdftk (http://www.accesspdf.com/pdftk/). It''ll do what you need very easily. HTH, Bill --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Thanks a lot, I''m gonna check it right now ^^ Olivier. On 20 feb, 15:12, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi Oliver, > > > > > > On Fri, 2009-02-20 at 11:09 -0800, CiriusMex wrote: > > Hi, I have a little issue here. I''m working on an eBook site and need > > to generate PDFs. I managed it using PDF::Writer and did the trick > > quite well but now I want to generate PDFs with a password access. > > After checking on internet, I saw that PDF::Writer encrypt method was > > removed (for encryption algorithm was cracked or something like that). > > Had a look at the Prawn plugin but it has no security module and can''t > > be used to do so. > > > Is there any way to create password protected PDFs with Ruby? > > > Other problem, I want to modifiy the PDF generation to create new PDFs > > by copying PDF files already existing and adding a front page with the > > customer name and a little message. I managed read PDF files and copy > > the content in a new PDF but I''m losing all the format (the result is > > just a new PDF with the text of the original PDF but with no > > format...). Anyone know how I can copy a PDF and add this front page? > > I worked through a very similar set of issues a couple of years ago. > Ended up using a system call to pdftk (http://www.accesspdf.com/pdftk/). > It''ll do what you need very easily. > > HTH, > Bill- Ocultar texto de la cita - > > - Mostrar texto de la cita ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, this toolkit seems pretty cool but my problem is that I want todo everything using Ruby, so I need a plugin or something that can connect to ruby in order to do the PDF copy etc using a ruby function... On 20 feb, 16:27, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Thanks a lot, I''m gonna check it right now ^^ > > Olivier. > > On 20 feb, 15:12, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi Oliver, > > > On Fri, 2009-02-20 at 11:09 -0800, CiriusMex wrote: > > > Hi, I have a little issue here. I''m working on an eBook site and need > > > to generate PDFs. I managed it using PDF::Writer and did the trick > > > quite well but now I want to generate PDFs with a password access. > > > After checking on internet, I saw that PDF::Writer encrypt method was > > > removed (for encryption algorithm was cracked or something like that). > > > Had a look at the Prawn plugin but it has no security module and can''t > > > be used to do so. > > > > Is there any way to create password protected PDFs with Ruby? > > > > Other problem, I want to modifiy the PDF generation to create new PDFs > > > by copying PDF files already existing and adding a front page with the > > > customer name and a little message. I managed read PDF files and copy > > > the content in a new PDF but I''m losing all the format (the result is > > > just a new PDF with the text of the original PDF but with no > > > format...). Anyone know how I can copy a PDF and add this front page? > > > I worked through a very similar set of issues a couple of years ago. > > Ended up using a system call to pdftk (http://www.accesspdf.com/pdftk/). > > It''ll do what you need very easily. > > > HTH, > > Bill- Ocultar texto de la cita - > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > - Mostrar texto de la cita ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I agree with Bill. pdftk has been an invaluable tool for me when working with pdfs, and can easily be wrapped for use in ruby. Altho you''ll want to add checks to ensure safety of params your passing to pdftk, and check for errors returned, ..., you could do something like: ... def add_user_pw_to_pdf(infile, pw, outfile) `pdftk #{infile} output #{outfile} user_pw #{pw} 2>&1` end def combine_pdfs(infiles, outfile) `pdftk #{infiles.join('' '')} output #{outfile} 2>&1` end ... which you could then call like: ... add_user_pw_to_pdf(''test.pdf'', ''supersecret'', ''test_with_pss.pdf'') ... combine_pdfs([''a.pdf'', ''b.pdf'', ''c.pdf''], ''abc.pdf'') ... Jeff On Feb 20, 3:14 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Ok, this toolkit seems pretty cool but my problem is that I want todo > everything using Ruby, so I need a plugin or something that can > connect to ruby in order to do the PDF copy etc using a ruby > function... > > On 20 feb, 16:27, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Thanks a lot, I''m gonna check it right now ^^ > > > Olivier. > > > On 20 feb, 15:12, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Hi Oliver, > > > > On Fri, 2009-02-20 at 11:09 -0800, CiriusMex wrote: > > > > Hi, I have a little issue here. I''m working on an eBook site and need > > > > to generate PDFs. I managed it using PDF::Writer and did the trick > > > > quite well but now I want to generate PDFs with a password access. > > > > After checking on internet, I saw that PDF::Writer encrypt method was > > > > removed (for encryption algorithm was cracked or something like that). > > > > Had a look at the Prawn plugin but it has no security module and can''t > > > > be used to do so. > > > > > Is there any way to create password protected PDFs with Ruby? > > > > > Other problem, I want to modifiy the PDF generation to create new PDFs > > > > by copying PDF files already existing and adding a front page with the > > > > customer name and a little message. I managed read PDF files and copy > > > > the content in a new PDF but I''m losing all the format (the result is > > > > just a new PDF with the text of the original PDF but with no > > > > format...). Anyone know how I can copy a PDF and add this front page? > > > > I worked through a very similar set of issues a couple of years ago. > > > Ended up using a system call to pdftk (http://www.accesspdf.com/pdftk/). > > > It''ll do what you need very easily. > > > > HTH, > > > Bill- Ocultar texto de la cita - > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > > - Mostrar texto de la cita ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ok, I didn''t understood it could be used with ruby, will check how to do that, thanks again for your help ;) On 20 feb, 18:35, Jeff Lewis <jeff.bu...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I agree with Bill. pdftk has been an invaluable tool for me when > working with pdfs, and can easily be wrapped for use in ruby. > > Altho you''ll want to add checks to ensure safety of params your > passing to pdftk, and check for errors returned, ..., you could do > something like: > > ... > def add_user_pw_to_pdf(infile, pw, outfile) > `pdftk #{infile} output #{outfile} user_pw #{pw} 2>&1` > end > > def combine_pdfs(infiles, outfile) > `pdftk #{infiles.join('' '')} output #{outfile} 2>&1` > end > ... > > which you could then call like: > > ... > add_user_pw_to_pdf(''test.pdf'', ''supersecret'', ''test_with_pss.pdf'') > ... > combine_pdfs([''a.pdf'', ''b.pdf'', ''c.pdf''], ''abc.pdf'') > ... > > Jeff > > On Feb 20, 3:14 pm, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Ok, this toolkit seems pretty cool but my problem is that I want todo > > everything using Ruby, so I need a plugin or something that can > > connect to ruby in order to do the PDF copy etc using a ruby > > function... > > > On 20 feb, 16:27, CiriusMex <cirius...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Thanks a lot, I''m gonna check it right now ^^ > > > > Olivier. > > > > On 20 feb, 15:12, bill walton <bwalton...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Hi Oliver, > > > > > On Fri, 2009-02-20 at 11:09 -0800, CiriusMex wrote: > > > > > Hi, I have a little issue here. I''m working on an eBook site and need > > > > > to generate PDFs. I managed it using PDF::Writer and did the trick > > > > > quite well but now I want to generate PDFs with a password access. > > > > > After checking on internet, I saw that PDF::Writer encrypt method was > > > > > removed (for encryption algorithm was cracked or something like that). > > > > > Had a look at the Prawn plugin but it has no security module and can''t > > > > > be used to do so. > > > > > > Is there any way to create password protected PDFs with Ruby? > > > > > > Other problem, I want to modifiy the PDF generation to create new PDFs > > > > > by copying PDF files already existing and adding a front page with the > > > > > customer name and a little message. I managed read PDF files and copy > > > > > the content in a new PDF but I''m losing all the format (the result is > > > > > just a new PDF with the text of the original PDF but with no > > > > > format...). Anyone know how I can copy a PDF and add this front page? > > > > > I worked through a very similar set of issues a couple of years ago. > > > > Ended up using a system call to pdftk (http://www.accesspdf.com/pdftk/). > > > > It''ll do what you need very easily. > > > > > HTH, > > > > Bill- Ocultar texto de la cita - > > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > > > - Mostrar texto de la cita -- Ocultar texto de la cita - > > - Mostrar texto de la cita ---~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---