PDFSharp - Report Document Colors and Transparency - pdf

I am having some problems with the PDF files that I make using the PDFSharp library. The files are ok as long as I am viewing them normally.
However I need these files to be changed using the accessibility options (Edit -> Preferences -> Accessibility (in the left menu Categories) -> Report Document Colors -> Custom Color). Whenever there is image with transperancy and/or transparent masks and the Background color is set to black everything disappears.
I looked at the PDFSharp code and it seems that they are setting some transparent SMask, which I did not find to do anything noticeable (at least for me), but I am not sure if I disable it will it screw up something that I cannot think of.
Most probably I won't get help on this one, but I hope that someone knows something more about this problem with PDF Transparency and the Accessibility options.

The transparency mask is created for images with transparency only.
So if your images contain black lines and a transparent background and you change the color of PDF pages to black, you will see black lines on a black background - you will see nothing.
If your images contain black lines on a white background, you will see your image as you know it: black lines on a white background.
Transparency is a feature, it's optional.
Maybe there's a bug in PDFsharp. If I watch the output of the Graphics sample with black background color, pages 4 and 5 are completely black (looks wrong to me).
The output of the Hello MigraDoc sample looks correct to me. The image on page 1 does not use transparency and keeps it white background, the chart on page 6 is transparent (which leads to black lines on a black background).
But maybe that's a bug in Adobe Reader - everything looks fine if I do not set a background color, but activate the transparency grid instead.
If you think that your images do not contain transparency, then we'll need files (PDF and image) for further examination.
Edit: I just checked the output of the Graphics sample with Adobe Acrobat 5 - all pages display correctly even with black background color. With Adobe Acrobat 8 and Adobe Reader X pages 4 and 5 are black. Looks like a bug in Adobe Acrobat/Reader to me.

Related

Why does printing with White Background Preferences in PDF not work?

I have a PDF that has a light yellow background for each page which if printed in black & white produces a gray background as expected. No problem here.
But now I want to set the background to white to save ink. There's a feature to do this in the Preferences of Adobe Acrobat Reader DC (64-bit). I'm setting the background to white using these settings:
This produces the correct print output preview of white, but when I print the page it still behaves like nothing has changed and I still get a gray background like in the print preview before settings were changed. Why does it not work? How do I properly set the settings so it truly prints no gray background, just white?

Smallest possible invisible PDF?

This question is related to What is the smallest possible valid PDF?, but goes one step further: I'd like a PDF file that is as small as possible, but also invisible.
That means:
it contains no text or other objects (or if that's not possible, only completely transparent ones), and
it has no background (or if that's not possible, a completely transparent background).
When I open this file in a compliant PDF viewer, the background color of the viewer panel should show through completely, and when I embed it in a document on top of other elements, only these other elements should show.
PDF pages have no background color by default (if you need an explicit background you have to draw a colored rectangle that covers the entire page).
PDF viewers will use a default white background to simulate a paper page, so the actual background depends on the PDF viewer.
When you place a PDF page on top of another one it will not block the underlying content if it does not have an explicit background.

How do you change text color of all the text of a particular color to another in pdf?

My Professor uses a very hard to see white font colour for about half of his lecture notes.
it is very hard to see on the slides, even worse printed out.
Is there a dynamic way to convert all white text in the entire document to black? hopefully there is a solution with Adobe Acrobat Pro DC which is what i am using, but im open to other suggestions.
In the Accessibility preferences, you can change the way text and line art is displayed. This isn't a permanent change but just changes how the PDF is drawn to the screen.

PDF Highlighting above image / below text

i'm trying to highlight text in a pdf, and have the highlighted rectangle to be drawn under the text.
It works fine on most PDF's, but I jumped into a problem when the text I'm trying to highlight has an image/background under it. The problem is that the highlight rectangle is drawn under the image as well, so it is not visible.
The drawing order I have is this:
draw a blank rectangle with the page size
draw the highlight
draw the pdf using CGContextDrawPDFPage(context, page);
Is there a way to draw the PDF images and text separately? so that I could go
blank rectangle
pdf images/background
highlight
pdf text
Do I have to do something to the pdf / context so that it draws it automatically the way I want it to? I've tried messing with the context but nothing worked so far, it's all drawn entirely under or entirely above the full pdf
Every reader I've seen does this (PDFExpert, GoodReader, iAnnotate to name a few), so it can't be impossible, I just haven't found the solution yet :)
Any help will help, thanks in advance!!
Cheers
My understanding is that these other apps are reading and rendering the PDF themselves (they support selecting text, or adding annotations, for example), so they would be able to much more easily layer things in the way you're mentioning.
The CGPDFDocument you're starting with is an opaque object (in the OO sense, not transparency) that can draw itself, but I don't know of any way to break out and render various sublayers of the document.
As a way forward, you could look at using Core Image (iOS5+) or some other method to blend the highlights layer with the PDF. If you used the right filter (Multiply, maybe), the darker text would still come through and a .3 alpha highlight would blend with any background.

.NET Graphics on Windows 7: White corners around images?

I've been working on some custom graphics controls, and I found this weird problem with windows 7 rendering my button controls. I've used Photoshop to delete the pixels in the background all around the button image I'm using, then saved it as a GIF, and imported it into VS to use as the background image of my button. When windows XP renders it, it is fine, but when windows 7 renders it, all 4 corners have an odd white border around them.
You can barely see them in this pic, but they are much more apparent when looking at them on the client PC's.
Is there something wrong with the way I am transfering the image? should I not use a gif? is there something wrong with the way I am displaying it on the button? What can I do about it?
GIF was a bad choice, it can only render images with 256 colors. You need all the colors you can get to make the anti-aliasing work properly. Use PNG.
You will also need to make sure that the background color of the container is the same as the one you used in Photoshop, the anti-aliasing pixels will otherwise have the wrong colors. And you cannot stretch the image, that will also stretch the anti-aliasing pixels, ruining the effect.