I'm not a programmer but I may need to have an application
developed which can create (or modify) a PDF File.

There appear to be libraries of code to assist with this.

Is it possible to say which is simpler

  • to convert from a WORD document
    or
  • from an HTML file

Thanks
Mike

    html is much easier I think. Words formatting is just plain screwy sometimes

      Hi!

      Take a look at www.fpdf.org, and click the "scripts" link. There are some scripts for handling HTML -> PDF there... not sure how advanced they are, but you can check it out.

        11 days later
        ???????? wrote:

        Hi!

        Take a look at www.fpdf.org, and click the "scripts" link. There are some scripts for handling HTML -> PDF there...

        These look good, thanks.

        I need to be able to change one field in
        a PDF File.

        There's an item

        == 17. Can I modify a PDF with FPDF?
        == You can import an existing PDF document thanks to the FPDI extension:

        Do you think this can do it ?

        Mike

          mikefox wrote:

          These look good, thanks.

          I need to be able to change one field in
          a PDF File.

          There's an item

          == 17. Can I modify a PDF with FPDF?
          == You can import an existing PDF document thanks to the FPDI extension:

          Do you think this can do it ?

          Mike

          It depends on the modifications you want to do on the existing PDF. With FPDI you can import a PDF and add something (text and/or images) to it ; but you can't replace something already written on the existing PDF. But if you want to change 1 field, you can let it blank on your PDF and then, with FPDI, write your text in the blank area. Or maybe you can put a white image on the field you want to replace, and then write over the image. But what I mean is that you can't edit an existing PDF with FPDI.

            Matth,

            I will need to replace some text in a string like this

            http://www.abc.com/xx,text,yy

            So you are saying I think that I could leave text blank.

            However the problem is that the replacement text may vary in
            size so would that make it not possible ?

            Mike

              I think you would be better off putting a standalone shell-script or program on your server to do this as the php modules take up too many resources for any real mass use. personally I would recommend creating the pdf files manually and uploading them unless you have a dedicated server, distributed networking or cluster it's much more cost effective
              why do you need to change one feild just keep pdf files for each feild change

                cyberlew15 wrote:

                Iwhy do you need to change one feild just keep pdf files for each feild change

                I'll explain the application.

                I want to allow visitors to my site to download a free
                ebook and have it rebranded on-the-fly.

                I just want to change one field in the book - an email
                address in a Paypal buy link.

                In other words Fred gives you a link
                http://www.abc.com/.../fred@zzz.com/....

                That allows you to download the book, within the book you
                will see a link 'Purchase here' and you will arrive at the
                Paypal order form ready to pay Fred.

                At the moment I just want to know if the rebranding part
                is technically possible and if so how difficult

                Thanks
                Mike

                  mikefox wrote:

                  Matth,

                  I will need to replace some text in a string like this

                  http://www.abc.com/xx,text,yy

                  So you are saying I think that I could leave text blank.

                  However the problem is that the replacement text may vary in
                  size so would that make it not possible ?

                  Mike

                  Hello,

                  It's difficult to give an accurate answer, because it depends on the length of the string you want to write and the blank area you can put on your pdf.
                  Anyway, if there's a problem of size, maybe you can detect the length of the text you want to write (php function strlen()), and adapt the size of the font to write smaller if the text is too long.
                  But I assume you already know the max length of the text that will be written on the blank area (I mean, if the text is a user's email adress, you will encounter a problem if you let users write too long email adresses, no matter how wide the blank area is). So, then you just need to adapt the blank area and the font size to the max allowed text length.

                  It could be less difficult to create the whole PDF with FPDI rather than using an exsiting PDF (creating a PDF with FPDI is rather simple) ; but once again it depends on your existing PDF.

                  To answer your other question, it's technicaly possible, but heavy for your server as cyberlew15 said.

                    Matth_S wrote:

                    So, then you just need to adapt the blank area and the font size to the max
                    allowed text length.

                    It's not a matter of displaying the link in a book
                    - the actual content won't be visible. The reader will click
                    on an Order Now button.

                    Matth_S wrote:

                    It could be less difficult to create the whole PDF with
                    FPDI rather than using an exsiting PDF (creating a PDF
                    with FPDI is rather simple) ; but once again it depends on
                    your existing PDF.

                    I assume that FDPI has certain limitations on what
                    it converts, is that correct ?

                    The PDF was actually created by converting from HTML
                    using the utility HTMLDOC, if that is a help.

                    Matth_S wrote:

                    To answer your other question, it's technicaly possible,
                    but heavy for your server as cyberlew15 said.

                    The creation of the book would only happen just a few
                    times a day, if that is a concern. Or is it a problem that
                    while the creation takes place it imposes a heavy load ?

                    Mike

                      Ok, sorry, I hadn't understood properly what you meant.

                      If what you want is laying a button the target of which depends on the user, it's even more simple :
                      You still need a blank area (to lay your button). In this area, you can put your button with the functions provided by FPDI ; I think you can use the function image() if your button is an image or link() if it's a text link. One parameter of those functions is an URL, which in your case depends on the user.

                      If it happens only a few times a day, it's not a problem at all for your server.

                      I hope it's what you needed !

                        and for the link based on an e-mail rather than a real file you need mod_rewrite

                        In other words Fred gives you a link
                        http://www.abc.com/.../fred@zzz.com/....

                        That allows you to download the book, within the book you
                        will see a link 'Purchase here' and you will arrive at the
                        Paypal order form ready to pay Fred.

                          Matth, cyberlew15

                          I think you are saying it's possible and not too difficult
                          - which is what I need to know.

                          Thanks for your help,

                          Mike.

                            14 days later

                            My programmer has successfully managed to rebrand a link
                            at the end of the book HOWEVER all other existing links in
                            the book have now become non-clickable.

                            Apparently it does say that FPDF does not support
                            importing existing links.

                            Any ideas on a way around this ?

                            Mike

                              Hi Mike,

                              currently there's no workaround for that. FPDI will not import any dynamic content, as they are not part of a content stream, but related to the page itselfs. These dynamic contents are links, form elements, ... Just imagine, like Matth_S already written, that FPDI is not really made for manipulating PDF documents, but for importing single pages of an existing one.

                              Jan

                                Write a Reply...