|
PDFsharp - moved to http://forum.pdfsharp.net/ Please visit the new PDFsharp forum at http://forum.pdfsharp.net/
|
Important Notice:
We regret to inform you that our free phpBB forum hosting service will be discontinued by the end of June 30, 2024.
If you wish to migrate to our paid hosting service, please contact billing@hostonnet.com.
View previous topic :: View next topic |
Author |
Message |
ojensen
Joined: 21 Feb 2008 Posts: 1
|
Posted: Thu Feb 21, 2008 10:09 pm Post subject: Recolor Existing Objects in PDF |
|
|
I need to be able to open a pdf and recolor a black object to some other color. I was doing this through abcPDF but I am looking to get away from their library (trash)
Below is the code I was using from their library. Perhaps someone can help me translate it to PDFSharp. Thanks
Doc theSource = new Doc();
theSource.Read(PDFUtilities.ServerMapPath(filepath));
// recolor the black portions
theSource.Flatten(); // ensure compressed
int thecount = Convert.ToInt32(theSource.GetInfo(theSource.Page, "/Contents:Count")); // get contents stream
int tempFor1 = thecount;
for (int j = 0; j < tempFor1; j++)
{
int theID = Convert.ToInt32(theSource.GetInfo(theSource.Page, "/Contents[" + j + "]:Ref"));
theSource.GetInfo(theID, "Decompress"); // ensure stream decompressed
string theContents = theSource.GetInfo(theID, "stream");
if (this.GetPDFColorCode(color) != string.Empty)
theContents = theContents.Replace("0 0 0 rg", this.GetPDFColorCode(color));
theSource.SetInfo(theID, "stream", theContents);
} |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|