79681493

Date: 2025-06-27 06:45:39
Score: 0.5
Natty:
Report link

The sdk’s doing what it’s supposed to in terms of running the code but the output file’s blank that tells me the page’s content isn’t getting committed properly and it’s probably not being added to the document structure at all which means it looks like it saved but nothing’s really in there first thing to fix you created the page and called SetContent() which is good but it’s missing this line right here doc->AddPage(-1, page);
that’s the bit that actually pushes the page into the doc hierarchy without that the page won’t exist in the saved file next thing to watch is the content stream even though you created a PdsText and set the text it won’t display unless the stream gets finalized so your call to SetContent() has to come after setting text and text state which you did correctly also make sure the matrix is scaling and positioning correctly yours is

PdfMatrix matrix = {12, 0, 0, 12, 100, 750};

that sets the font size to 12 and places the text 100 over and 750 up which is visible on an A4 page so no issue there and font loading looks solid too you’re finding Arial with

FindSysFont(L"Arial", false, false);

and then creating the font object fine so that’s good so yeah all signs point to that missing AddPage line drop it in right after setcontent() like this:

page->SetContent(); doc->AddPage(-1, page);

then save like you’re doing, and you should be good text will show and the file won’t be empty hit me back if you want to draw shapes or mess with multiple pages or images happy to walk through more steps if you need it

Reasons:
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Brian Stanley