Create PDF with Python | Part 3

  Рет қаралды 35,087

Chart Explorers

Chart Explorers

Күн бұрын

Пікірлер
@enriquepereira5918
@enriquepereira5918 3 жыл бұрын
self.cell(0, 10, f'Page: {self.page_no()}/nb', 0, 0, 'C') pdf.alias_nb_pages(alias='nb') in case anyone has problems with that thnk you so much
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Thanks Enrique! I appreciate it. I looks like this is a change made in the most recent update.
@bibashshrestha9471
@bibashshrestha9471 3 жыл бұрын
@@ChartExplorers hlw sir!! This is about opening file from local storage but what i want is as explained below: The output of my python code is a gui tkinter window containing labels and other stuffs which also has a button at bottom side so suppose if my output is the result of exam and i want to download that result as pdf file and save in my computer when i press the button lying at bottom of tkinter window how can i do that?Plz hlp me out....
@ChartExplorers
@ChartExplorers 3 жыл бұрын
@@bibashshrestha9471 where are you downloading the pdf from? Is it created with your Tkinter GUI?
@bibashshrestha9471
@bibashshrestha9471 3 жыл бұрын
@@ChartExplorers my gui is not creating a pdf neither i m downloading from anywhere. When i jst run my python code , the output is tkinter window containing labels which i want to save as it is in my computer.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
@@bibashshrestha9471 Can you send me your code and screen shots. I'm having a hard time understanding what you currently have and what you are trying to accomplish. bradonvalgardson@gmail.com
@kostas6915
@kostas6915 2 жыл бұрын
The diagram and the explanation rocks!!! well done!!! so 10/10
@cameosisj6007
@cameosisj6007 2 жыл бұрын
That graphical breakdown of that pdf width function 👌🏾
@soureachsak5027
@soureachsak5027 3 жыл бұрын
The diagram and the explanation is incredibly good. [5-stars review]
@kellymweu2781
@kellymweu2781 5 ай бұрын
diagram rating 1. Really understood the context
@jpcervone16
@jpcervone16 2 жыл бұрын
the diagram illustrated perfectly, I give it a 10!! Thank you so much
@jpcervone16
@jpcervone16 2 жыл бұрын
i mean 1 i guess lol
@simaobonvalot7697
@simaobonvalot7697 3 жыл бұрын
From 1 to 10 , that explanation of the logic behind the width and centering the tile was a 10. (PRETTY GOOD) ;)
@rhysbennett1667
@rhysbennett1667 3 жыл бұрын
Thank you so much for continuing!!
@ChartExplorers
@ChartExplorers 3 жыл бұрын
You're welcome, I'm glad you are enjoying!
@AKKJ420
@AKKJ420 2 жыл бұрын
You are an amazing teacher. Liked and subs
@joebashour
@joebashour 3 жыл бұрын
On a scale of 1-10, I think the explanation document deserves a 0 because it really served its purpose well. Great explanation and great video overall (videos actually as there are other parts). Much appreciated!
@mrmuranga
@mrmuranga 3 жыл бұрын
explanation served the purpose...well done and thanks for making the effort to explain
@bipolarchemist
@bipolarchemist 2 жыл бұрын
Shoutout for the subtly Pan diagram. Great series, maybe had my programming teachers taught more like you, I would have remained a CS major instead of discovering new horrors in Chemistry.
@ajsunofficial6798
@ajsunofficial6798 Жыл бұрын
A video needed for creating a pdf file from multiple excel pages in python. It includes tables and charts
@rundeks
@rundeks 3 жыл бұрын
Diagram was really well done!
@TheCouncellor7
@TheCouncellor7 Жыл бұрын
Awesome tutorial, awesome teacher, 10/10 understanding, 10/10 explanation and 1 for the diagram (didn't go blind :) Thank you very much 👍🙏
@yamenmaani6523
@yamenmaani6523 2 жыл бұрын
this digograme is so awesome
@adrianmisak07
@adrianmisak07 Жыл бұрын
the diagram was excellent
@michaelreis7435
@michaelreis7435 3 жыл бұрын
Great video series! Thank you. The timing is fortuitous for me and has helped me with a work project. I would certainly be interested in a video about uploading text files to create pdfs.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Thank you. I'm glad it helped. In the fourth video we go over how to create PDFs from txt files. Does that help in what you are trying to do?
@michaelreis7435
@michaelreis7435 3 жыл бұрын
@@ChartExplorers Yes! Thank you again for making these videos.
@Xaveth
@Xaveth 3 жыл бұрын
Awesome diagram illustrating the width math! 9.5 for illustration.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Thanks! I went through several iterations of this diagram so I'm glad you liked it :)
@Xaveth
@Xaveth 3 жыл бұрын
@@ChartExplorers Definitely. I can tell a lot of thought went into that one. One thing to give an answer and a whole other to clearly explain the answer. Nice job!
@ananyobratapal5521
@ananyobratapal5521 3 жыл бұрын
For the record, 0 (Ugly) Thank you and keep up the good work ❤️
@hunakosdem
@hunakosdem Жыл бұрын
As someone with a background of a mechanical engineer I especially love your explanation here: kzbin.info/www/bejne/fJTViGB7iMmMY6M It's a solid 10! Virtually everyone else just runs through their calculations in these cases like "something minus something plus an other something divided by two equals this bit here which we're going to use as a float value of this randomly mentioned parameter" :)
@gabrielabarrera141
@gabrielabarrera141 Жыл бұрын
Hi, thanks for your video series, very helpful. I have a question... I'm implementing a form (in django) and i don't know how can override the header method passing arguments coming from the form, can you give me a hadn?
@v_tsepish
@v_tsepish 3 жыл бұрын
Thx a lot. Your video helps me so much!
@ChartExplorers
@ChartExplorers 3 жыл бұрын
You're welcome, good luck making those PDFs!!
@percyleoncio
@percyleoncio 2 жыл бұрын
Excelente explicación, muchas gracias por ello Como haría si por ejemplo tengo un pdf de 10 páginas, y necesito ponerle como numero de pagina empezando la primera página como número de pagina= 10, la siguiente pagina= 9, y asi llegar a la última página del documento pdf el número de pagina= 1.
@mustafacan2361
@mustafacan2361 Жыл бұрын
Hello sir. Thanks for your records. They were totally helpful for pdf operation. Is there any reason that you did not use fd.readlines() /readline() instead of fd.read().decode() ? (file should be opened as "with open(name) as fd:" for readlines()/ readline() method.)
@MURALIKRISHNAhai
@MURALIKRISHNAhai 3 жыл бұрын
Thank you Could you please explain how to attach existing pdf files to the newly created pdf and establish the links from the newly created pdf to the other added pdf pages instead of writing content from a text file I am using existing pdf files to attach to the pdf made by your lectures and trying to establish the links from top page to other pages
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi @MURALI KRISHNA, I am actually in working on my next set of videos to describe this. In the mean time this is a great article to get you started realpython.com/creating-modifying-pdf/#using-the-pdffilewriter-class You will have to use the library PyPDF2 library to merge PDFs.
@spiralcarbon8658
@spiralcarbon8658 3 жыл бұрын
Thank you Sir. May i ask how to save the output to a specified folder.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
You're welcome. To save to a specific folder you will pass the folder path and then the pdf name to pdf.output(). for example if I am on Windows and wanted to save my pdf to my desktop and call it my_pdf.pdf I could use the following pdf.output('C:\Users\bvalg\Desktop\my_pdf.pdf')
@aliuslubas
@aliuslubas 2 жыл бұрын
Thanks a lot for this video. I would be appreciated for a video contaning more information on this regard. with open(name, 'rb') as fh: txt = fh.read().decode('latin-1')
@prudentia8210
@prudentia8210 3 жыл бұрын
I have been trying to add a date variable on top right. If i am successful at that then i fail at the initial call which is calling the 'Landscape'
@MateoToquica
@MateoToquica 3 жыл бұрын
thank you so much!!!!
@ChartExplorers
@ChartExplorers 3 жыл бұрын
You're Welcome!
@MURALIKRISHNAhai
@MURALIKRISHNAhai 3 жыл бұрын
With FPDF package instead of depending on text files for writing information into our PDF file can we use the existing PDF files to attach to our PDF file. It's like whatever the pdf file we are creating we will create it with the already existing pdf file
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Yes you can. I will be putting out a video tomorrow that talks about this problem. The link I sent to you in my other replies talks about how to do this. You will need to use the PyPDF2 library. realpython.com/creating-modifying-pdf/#concatenating-and-merging-pdfs
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi I released this video a little earlier than I planned. kzbin.info/www/bejne/ZnOYf2mOqZp-brM This discusses how to extract text from PDF files using PyPDF2. It doesn't address your specific question, but should give you a head start on solving your problem. You will have to also use PyPDF2 and FPDF2 to accomplish your goal. I will create a specific video on this topic in the coming days.
@MURALIKRISHNAhai
@MURALIKRISHNAhai 3 жыл бұрын
Hi Mr. Bradon, Here is what I have::: A bunch of PDF files which has complex equations+ tabular headers and footers+ page index etc... Here is what I tried::: 1.I tried what you did in part1,2,3 &4 of handling pdf with python 2.I have converted all those bunch of pdf files into .txt files {But after conversion they look weirdly bad, But I was hoping I could able to reproduce the same good PDF files with those .txt files} 3.I just followed your lectures from part1 to part4 and use those .txt files to create one single PDF with index of every individual pdf file name and activated links {I have used for loop many places to iterate through all .txt files and add them to the wishful large pdf file} Do you think is this the right way to follow. I am dearly waiting for your new video on how to merge pdf files and create a good looking index file after merging to create one single large pdf file
@ChartExplorers
@ChartExplorers 3 жыл бұрын
@@MURALIKRISHNAhai If I understand your needs correctly, it sounds like it will be much easier to merge the existing pdf's together will be much easier (because then you can keep the formatting). I'm almost done with the video :)
@MURALIKRISHNAhai
@MURALIKRISHNAhai 3 жыл бұрын
Hi Mr. Bradon, I am very much excited and looking forward to watch your next video on pdf merging with TOC creation.
@jovensaventureiros
@jovensaventureiros 2 жыл бұрын
Hello, before anything I wanna to thank u for this videos, helped me a lot. I wanna ask u if u know how can I fix some error. I'm saving some form in a database and creating PDFs with this data, but the multi_cell attribute isn't work as I expect, it's not breaking lines. Have u have some idea how can I fix this? Again, thx for this videos and congratulations to your channel.
@michaelpolicella2588
@michaelpolicella2588 2 жыл бұрын
Great teacher. somehow though the text that is displayed on chrome has each line spaced to the complete width of the page. Effectively the words have varying space between them. I have Win10 . Tried all sorts of things but nothing worked and could not find a solution on the web. But really , love the tutorial.
@oladejiolaoluwa9155
@oladejiolaoluwa9155 Жыл бұрын
i tried using chatgpt to create an article but when i wanted to convert it into pdf using the multi_cell it did not work instead it kept on throwing an error........it said something about decode('latin-1').....please how can i fix this
@souleymanetraore1353
@souleymanetraore1353 3 жыл бұрын
Thank you for these videos can u make one on how to concatene pdf files with fpdf please.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi Souleymane, fpdf is a library for creating pdf's but it cannot modify (merge split) them. In order to merge or split a pdf you would need to use another library... something like pypdf4 github.com/claird/PyPDF4. I would be happy to make a video on this. I have a couple other videos that I've been working on that I will get out before I can get to this video. Do you have a deadline of when you need this information?
@carlcreighton6157
@carlcreighton6157 3 жыл бұрын
I am doing a web scraper project and am trying to move the text I scrape onto a pdf. however the websites that I am scraping have strange symbols that dont translate into txt files unless you substitute the characters for another. and I cannot decode because they are strings. any advice? python will print the code in run box but will not make it a txt. UnicodeEncodeError: 'latin-1' codec can't encode character '\u2019' in position 999: ordinal not in range(256)
@alexmejia369
@alexmejia369 3 жыл бұрын
Hi Brandon. I'm enjoying your presentation very much. You keep mentioning "...you'll find it in my links.." Where do I find those links Is the presentation code in your links as well? Thank you.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi Alex! Usually in the description of the video (you'll probably have to click on show more), but sometimes I mention some content and forget to link to it! Let me know if the link isn't there and I'll get right on it. If by chance you are looking for the link to the documentation you can find it here pyfpdf.github.io/fpdf2/index.html
@AlCatrraz
@AlCatrraz Жыл бұрын
hey... Is there a way to PRINT on the page at any location by the X:Y coordinates? I have AN OOOOLD APP that uses MS ACCESS, and I generate very COMPLEX charts - and may small, framed, pieces of data. and with MANY COLORS... I want to get back into programing, after many years, and this will be a good project for me to do.... Also, is there a way to GO BACK to print on PREVIOUS PAGE? Thanx
@cantstandya3761
@cantstandya3761 3 жыл бұрын
Hi, one thing I don't seem to understand is the footer and header methods; can't see that they are being called; are these overloaded methods and run automatically by the constructor?
@cantstandya3761
@cantstandya3761 3 жыл бұрын
Great tutorial by the way.
@cantstandya3761
@cantstandya3761 3 жыл бұрын
Forget it; found the answer in the api-documentation - and for those interested here is the statement from the documentation; "Footer to be implemented in your own inherited class. This is automatically called by add_page() and close() and should not be called directly by the user application. The default implementation performs nothing: you have to override this method in a subclass to implement your own rendering logic."
@cantstandya3761
@cantstandya3761 3 жыл бұрын
I'm guessing the same applies to header :)
@rickygevais9412
@rickygevais9412 3 жыл бұрын
This is great I mainly use Java by using Java I mean started to learn Java but after seeing this I going to switch to python because this looks incredible. How did you manage to come up with this idea? It also looks so professional like a pdf book you would buy, what you made pick 20,000 leagues under the sea? I love the way you used page objects, how did you come up with that, did you design first hand before writing the code.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Thanks Ricky. I can't take credit for this at all. This is up on the FPDF2 tutorial homepage (pyfpdf.github.io/fpdf2/Tutorial.html) I've made a few tweaks here and there to make it a little easier to understand or to demonstrate certain examples more clearly. What do you build with Java?
@rickygevais9412
@rickygevais9412 3 жыл бұрын
@@ChartExplorers Thanks, I still learning the basics, but mostly things like tic-tac-toe, hangman, sudoku, etc.
@ChartExplorers
@ChartExplorers 3 жыл бұрын
@@rickygevais9412 Nice, that's a great place to start!
@rickygevais9412
@rickygevais9412 3 жыл бұрын
@@ChartExplorers Thanks
@jackatkott7495
@jackatkott7495 3 жыл бұрын
Hi Bradon, thank you for the awesome tutorial series. One question: Why is the first page blank? What should I do if I want to fill the first page with content too. Cheers and keep up the good work!
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi Jack, thanks! If you send me your code I could take a look. You're content should start on the first page. bradonvalgardson@gmail.com
@jackatkott7495
@jackatkott7495 3 жыл бұрын
@@ChartExplorers Found it: pdf.add_page() Thank you for the quick reply!
@ChartExplorers
@ChartExplorers 3 жыл бұрын
@@jackatkott7495 awesome!
@tojoeinstein5558
@tojoeinstein5558 2 жыл бұрын
how to generate pdf ... data from sqlite
@SachinSharma-vl5wh
@SachinSharma-vl5wh 2 жыл бұрын
UnicodeEncodeError: 'latin-1' codec can't encode character '\u201c' in position 1165: ordinal not in range(256)
@ChartExplorers
@ChartExplorers 2 жыл бұрын
Hey! I hate unicode errors!! hmmm, do you have any special characters in the text you are using to create the pdf? If so what is it? I can then try to figure out how to include these special characters.
@mr.6889
@mr.6889 3 жыл бұрын
how to underline an in-between text... like "Hello world this is me" -> i want to underline world, thanks
@ChartExplorers
@ChartExplorers 3 жыл бұрын
Hi Mr. Sam! Well sadly to do this it isn't as straight forward as it might seem. I made a short video kzbin.info/www/bejne/eaDdiq2or5yZY80 that describes how to do this. If you ever come across another way of doing this please let me know. The problem is more traditional ways of underlining text don't seem to work with fpdf2.
@imenecharabi8945
@imenecharabi8945 3 жыл бұрын
That diagram isn't ugly at all
@vardhmansoftec7371
@vardhmansoftec7371 3 жыл бұрын
ALGERIAN font ?
@Lexp2008
@Lexp2008 Жыл бұрын
Why is no one talking about the fact that the text is only covering half of the page? 😵
@user-rf4vc7mt4d
@user-rf4vc7mt4d Жыл бұрын
10
Create PDF with Python | Part 4
7:30
Chart Explorers
Рет қаралды 23 М.
Create PDF with Python | Part 2
11:37
Chart Explorers
Рет қаралды 51 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН
Create PDFs in Python FULL TUTORIAL
31:22
BigPlot
Рет қаралды 10 М.
Create Stunning Python GUIs in 10 Minutes With Drag & Drop
11:38
Coding Is Fun
Рет қаралды 105 М.
Create PDF with Python | Part 1
10:03
Chart Explorers
Рет қаралды 121 М.
Новый год 2025 на ТНТ "ComedyVision!" @ComedyClubRussia
1:16:57
How to generate Reports with Python automatically - 4: PDF directly
10:09
Lianne and Justin
Рет қаралды 37 М.
How to Create PDF Files with Python [New Method 2024]
22:27
The PyCoach
Рет қаралды 58 М.
coco在求救? #小丑 #天使 #shorts
00:29
好人小丑
Рет қаралды 120 МЛН