Editing file

Just starting out? Need help? Post your questions and find answers here.
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Editing file

Post by jak64 »

Editing file

Good morning,
I would like to create a program in PureBasic to generate rent receipts. I have a pdf model (possibly another LibreOffice format) with my signature and I would like:

1) Open this template
2) Being able to modify the dates, possibly the amounts
3) Save the updated document
4) Send it by email

I must admit that I don't know how to do this at all and whether it is possible in PureBasic.

Thank you for your help.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Editing file

Post by Marc56us »

jak64 wrote: Sun Jan 05, 2025 7:25 pm I would like to create a program in PureBasic to generate rent receipts. I have a pdf model (possibly another LibreOffice format) with my signature and I would like:

1) Open this template
2) Being able to modify the dates, possibly the amounts
3) Save the updated document
4) Send it by email
You can't open and/or edit template (.doc, .pdf etc) with PB
But you can create new pdf file.

See help VectorDrawing create text, frames, insert image (signature) and use PdfVectorOutput()
BarryG
Addict
Addict
Posts: 4219
Joined: Thu Apr 18, 2019 8:17 am

Re: Editing file

Post by BarryG »

jak64 wrote: Sun Jan 05, 2025 7:25 pmwhether it is possible in PureBasic
Of course it's possible. I've never done it, though. My first thought is to have an image with blank spots for the editable parts, and just draw text on those parts with the relevant data that you've entered. Then email the image as an attachment when done.
AZJIO
Addict
Addict
Posts: 2223
Joined: Sun May 14, 2017 1:48 am

Re: Editing file

Post by AZJIO »

Marc56us wrote: Sun Jan 05, 2025 9:53 pm You can't open and/or edit template (.doc, .pdf etc) with PB
I made such a program on Autoit3. DOCX file is an archive. You need to unpack the archive, make the replacement of texts and pack it back. One woman asked me to make her templates, since she had to fill out 6 documents for each transaction, and if it were a program that automatically inserted the client’s data, this would simplify the routine. The window opens where it enters the client’s data, and the program inserts this data into the contract.

The author asks too much, as if we must write a program for him.
Marc56us
Addict
Addict
Posts: 1600
Joined: Sat Feb 08, 2014 3:26 pm

Re: Editing file

Post by Marc56us »

There's no need to make a program, the mailing function of all word processors will do it all by itself (a table for addresses and amounts and a form for the letter.)
Save as PDF so that it can be read by any OS, even without an image viewer.

Other solution: create a PDF form (free with LibreOffice).

But if the author wants a PB program, then the VectorDrawing solution is the simplest (there's not much information to write in a rent receipt). This is also the simplest solution if your word processor doesn't include a function for writing the amount in words. (Some versions of spreadsheets may have it, but it's also a solution.)
jak64
Enthusiast
Enthusiast
Posts: 639
Joined: Sat Aug 15, 2020 5:02 pm
Location: Ciboure (France)

Re: Editing file

Post by jak64 »

Hello everyone,
thank you for your messages.
I didn't want anyone to write a program for me, I just wanted to know if we could modify an existing PDF document.
Have a nice day everyone
Axolotl
Addict
Addict
Posts: 872
Joined: Wed Dec 31, 2008 3:36 pm

Re: Editing file

Post by Axolotl »

@jak64
maybe you find something in this thread: Replace text in .pdf file?
Just because it worked doesn't mean it works.
PureBasic 6.04 (x86) and <latest stable version and current alpha/beta> (x64) on Windows 11 Home. Now started with Linux (VM: Ubuntu 22.04).
Post Reply