-
-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement Export to PDF #3
Comments
For ideas that might be good to graph:
While the further pages should contain more advanced information and graphs, which could be useful for people who are using this application as a way to manage a company/more complex finances. These sort of more advanced statistics would be a good step forward if the aim of this application was to replace non FOSS accounting software. Another option should be to remove hard financial figures, and replace them with percentages, allowing the user to share their financial data, without relieving their wealth, which would be a good extra feature. I also thing that it would be a good idea to present this data in-app. Either way, I'll look into some more ideas |
An initial page with graphs like a dashboard would be really great. One graph with my expenses as an example would help me see where I'm using more money in a faster way in comparison with other groups (medicines, travels, food, etc.). |
You can track PDF progress on this branch: https://github.com/nlogozzo/NickvisionMoney/tree/pdf-reports So far we have a basic blank page: If someone would like to open the PDF in I know @fsobolev is great at UI design but idk about Document Design 😄 |
A question i would have for the PDF is if it should follow the GNOME Style? I personally think so, but at the same time applications like apostrophe don't, so I guess it is up for debate? |
I don't really know how to create a "GNOME-Styled" PDF since all i can draw are lines and text. |
Oh, that is understandable, but will you be able to plot graphs? |
I should be able to although I may need to draw the whole graph manually. I'm using libharu as the pdf library, which I'm slowly learning as I go along. |
Love drawing PDFs with C code 😆 //Initialize PDF
HPDF_Doc pdf{ HPDF_New([](HPDF_STATUS, HPDF_STATUS, void* data){ *reinterpret_cast<bool*>(data) = false; }, &success) };
//First Page
HPDF_Page page1{ HPDF_AddPage(pdf) };
HPDF_Page_SetSize(page1, HPDF_PAGE_SIZE_LETTER, HPDF_PAGE_PORTRAIT);
//First Page - Main Box
HPDF_Page_SetLineWidth(page1, 0.5);
HPDF_Page_Rectangle(page1, 10, 10, HPDF_Page_GetWidth(page1) - 20, HPDF_Page_GetHeight(page1) - 20);
HPDF_Page_Stroke(page1);
//First Page - Font
HPDF_Font fontTitle{ HPDF_GetFont(pdf, "Helvetica", nullptr) };
//First Page - Title
HPDF_Page_SetFontAndSize(page1, fontTitle, 11);
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 14, HPDF_Page_GetHeight(page1) - 24);
HPDF_Page_ShowText(page1, std::filesystem::path(m_path).filename().c_str());
HPDF_Page_EndText(page1);
//First Page - Icon
HPDF_Image imageIcon{ HPDF_LoadJpegImageFromFile(pdf, pathToSymbolicIcon.c_str()) };
HPDF_Page_DrawImage(page1, imageIcon, HPDF_Page_GetWidth(page1) - 50, HPDF_Page_GetHeight(page1) - 50, 32, 32);
//First Page - Income
HPDF_Page_SetFontAndSize(page1, fontTitle, 9);
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 20, HPDF_Page_GetHeight(page1) - 54);
HPDF_Page_ShowText(page1, std::string("Income: " + MoneyHelpers::boostMoneyToLocaleString(getIncome(), locale)).c_str());
HPDF_Page_EndText(page1);
//First Page - Expense
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1,20, HPDF_Page_GetHeight(page1) - 70);
HPDF_Page_ShowText(page1, std::string("Expense: " + MoneyHelpers::boostMoneyToLocaleString(getExpense(), locale)).c_str());
HPDF_Page_EndText(page1);
//First Page - Total
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 20, HPDF_Page_GetHeight(page1) - 86);
HPDF_Page_ShowText(page1, std::string("Total: " + MoneyHelpers::boostMoneyToLocaleString(getTotal(), locale)).c_str());
HPDF_Page_EndText(page1);
//Save and Close PDF
HPDF_SaveToFile(pdf, path.c_str());
HPDF_Free(pdf); |
That, is an impressive amount of code.
…On Sat, Nov 26 2022 at 11:21:29 -0800, Nick Logozzo ***@***.***> wrote:
<https://user-images.githubusercontent.com/17648453/204105658-71af6b4b-d959-4bf8-966e-fa11848f0c60.png>
Love drawing PDFs with C code 😆
//Initialize PDF
HPDF_Doc pdf{ HPDF_New([](HPDF_STATUS, HPDF_STATUS, void* data){
*reinterpret_cast<bool*>(data) = false; }, &success) };
//First Page
HPDF_Page page1{ HPDF_AddPage(pdf) };
HPDF_Page_SetSize(page1, HPDF_PAGE_SIZE_LETTER, HPDF_PAGE_PORTRAIT);
//First Page - Main Box
HPDF_Page_SetLineWidth(page1, 0.5);
HPDF_Page_Rectangle(page1, 10, 10, HPDF_Page_GetWidth(page1) - 20,
HPDF_Page_GetHeight(page1) - 20);
HPDF_Page_Stroke(page1);
//First Page - Font
HPDF_Font fontTitle{ HPDF_GetFont(pdf, "Helvetica", nullptr) };
//First Page - Title
HPDF_Page_SetFontAndSize(page1, fontTitle, 11);
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 14, HPDF_Page_GetHeight(page1) - 24);
HPDF_Page_ShowText(page1,
std::filesystem::path(m_path).filename().c_str());
HPDF_Page_EndText(page1);
//First Page - Icon
HPDF_Image imageIcon{ HPDF_LoadJpegImageFromFile(pdf,
pathToSymbolicIcon.c_str()) };
HPDF_Page_DrawImage(page1, imageIcon, HPDF_Page_GetWidth(page1) - 50,
HPDF_Page_GetHeight(page1) - 50, 32, 32);
//First Page - Income
HPDF_Page_SetFontAndSize(page1, fontTitle, 9);
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 20, HPDF_Page_GetHeight(page1) - 54);
HPDF_Page_ShowText(page1, std::string("Income: " +
MoneyHelpers::boostMoneyToLocaleString(getIncome(), locale)).c_str());
HPDF_Page_EndText(page1);
//First Page - Expense
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1,20, HPDF_Page_GetHeight(page1) - 70);
HPDF_Page_ShowText(page1, std::string("Expense: " +
MoneyHelpers::boostMoneyToLocaleString(getExpense(),
locale)).c_str());
HPDF_Page_EndText(page1);
//First Page - Total
HPDF_Page_BeginText(page1);
HPDF_Page_MoveTextPos(page1, 20, HPDF_Page_GetHeight(page1) - 86);
HPDF_Page_ShowText(page1, std::string("Total: " +
MoneyHelpers::boostMoneyToLocaleString(getTotal(), locale)).c_str());
HPDF_Page_EndText(page1);
//Save and Close PDF
HPDF_SaveToFile(pdf, path.c_str());
HPDF_Free(pdf);
—
Reply to this email directly, view it on GitHub
<#3 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ARSOFBJTXUARJWYFHTUHIADWKJPLTANCNFSM6AAAAAARSBKZFQ>.
You are receiving this because you commented.Message ID:
***@***.***>
|
The PHP library FPDF has a lot of examples of scripts that you might find helpful as a reference/resource when making the pdf generation tool. http://www.fpdf.org/en/script/ex20.pdf While it is a completely different library in a completely different languish, I hope that you will find something there that might help you. |
I can help you write a wrapper around that! It would be great if someone could make or find a beautiful template for financial information. I'll be able to work on it after Dec 8th in case you haven't done it by then. |
Thanks for the idea! I built a light wrapper for a PDF page and document that I am building as I go along. |
Perhaps the diagram could also be drawn in the application using the |
I know this is low-effort production but see if this inspires you. Public domain/CC-BY. Pros:
|
Here's some information that could be generated and used. Basic, doesn't require new function
These could be calculated by the selected range Extensions---would require new function(s) and may not be useful for some users
There's 12 columns in the report template. The basics ones requires 7 columns (assuming Top Expense Group lists 3). Or we could use every other column. The indent of the income and expense could be modified from -0.06 (both before-text and after) to -0.16 to fit 100 vertical bar for easier calculation. You'd need to change the indent of "income" and "expense" to -0.10 before-text as well. |
Custom currency option shown in #128 is not about additional currency for an account, but about setting a currency that is not the one defined by a user locale. And even if we would add ability to show balance in multiple currencies, it's very problematic to convert (see #130 (comment)). |
It's not about converting to local currency. That's another feature (Local currency equivalent). We could instead just use the currency sign (take £ as example) and display it like £300.00. I guess this is common in saving accounts? And for the multiple currencies part, it could probably be a hidden group (sorry I only know a bit python so can't really help there) report_template.odt |
I'm sorry, but is this feature implemented? I cannot find it in the app. |
Thanks! |
Maybe the PDF could include diagrams? A pie chart that shows expenses for each group. A line chart that shows expenses for each month. A heat map that shows expenses for every day of the year. |
That will come with #289 |
No description provided.
The text was updated successfully, but these errors were encountered: