Rank: Member
Groups: Registered
Joined: 10/19/2017(UTC) Posts: 14 ![United States United States](/Content/images/flags/US.png) Location: North Carolina Was thanked: 1 time(s) in 1 post(s)
|
I am trying to draw up a simple app to show how to change the font size of a PdfTextObject. What I have thus far: Code: public partial class Form1 : Form
{
public Form1()
{
PdfCommon.Initialize("");
InitializeComponent();
}
private void BtnLoad_Click(object sender, EventArgs e)
{
using (OpenFileDialog ofd = new OpenFileDialog
{
AutoUpgradeEnabled = true,
CheckFileExists = true,
CheckPathExists = true,
ReadOnlyChecked = true,
DefaultExt = "pdf",
DereferenceLinks = true,
SupportMultiDottedExtensions = true,
ShowHelp = false,
Multiselect = false,
ShowReadOnly = false,
Title = "Please select a PDF file."
})
{
DialogResult dr = ofd.ShowDialog();
if ((dr == DialogResult.Yes) || (dr == DialogResult.OK))
{
PdfDocument doc = PdfDocument.Load(ofd.FileName, new PdfForms());
doc.Pages[0].PageObjects.OfType<PdfTextObject>().First().FontSize += 20;
doc.Save(@"C:\temp\Output.pdf", SaveFlags.RemoveUnusedObjects);
}
}
}
}
This is just a rough draft, obviously - no error checking, etc. The point is, when I get down to line 30, I can see the FontSize property of that particular object does in fact change. And when I look at the two PDF's (source and saved) they are in fact different file sizes. But physically, when I open the output file, I see no difference in that PdfTextObject at all. I've also tried changing the matrix, and also am unable to change the output's appearance. Am I just taking the wrong approach here? Edited by moderator Thursday, February 27, 2020 11:26:02 PM(UTC)
| Reason: Not specified
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 1/5/2016(UTC) Posts: 1,107
Thanks: 7 times Was thanked: 130 time(s) in 127 post(s)
|
|
|
|
|
Forum Jump
You can post new topics in this forum.
You can reply to topics in this forum.
You can delete your posts in this forum.
You can edit your posts in this forum.
You cannot create polls in this forum.
You can vote in polls in this forum.
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close