Smallest possible invisible PDF? - 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.

Related

Obscuring a bottom part of the screen by a "curtain" while displaying a pdf file

Is there a way to obscure a bottom part of the screen by a "curtain" while displaying a pdf file? I would like to be able to do that while using a classroom lcd projector, so that I can make students focus on the upper part of a page and ask questions before showing the rest of the page. The curtain should be easily movable up and down, like a blank page covering part of display in the old style overhead projectors.
Obviously, the "curtain" program could be independent of pdf viewer, as long as it can work with a pdf viewer in the full screen mode.
(Anticipating comments: slide shows with layers eliminate need for a curtain, but 1. preparing them takes a lot more time and time if of the essence 2. I need to display certain pdf documents which are not slide shows.)

live tiles in Windows Phone and Grids

I'm trying to create a live tile for my application, using a user control.
The user control contains a grid, an image and a rectangle filled with color.
Now here comes the funny part.
I want the rectangle to act as a background for the tile's title, and the image to fill the rest of the tile. And i said to myself, well, lets put some rows in that grid and set the like you usually set them in a WPF/SL application.
I then write the entire thing in a WBM and save it to isostore.
The problem is, the parser seems to ignore the presence of grid's rows. regardless of what I try, the rectangle is not shown, and the image covers the full tile, when it should only cover the first row. It is as if the grid didn't even existed.
Another funny aspect is that it doesn't matter if I use rows or columns, the result is the same.
Any ideas?
Are you using the following method?
Dynamic LiveTile - adding background image?
I recently implemented a Live Tile using a Grid with Rows and Columns for layout of some TextBlocks. I encountered similar challenges, so I placed the control that I was using for my Live Tile on a blank page in my app to better see what was happening. Does the control render correctly when displayed on a page (versus being rendered to a WriteableBitmap)?
Another idea. Instead of trying to position the Rectangle relative to the tile's Title, why not leave the Title property blank and put the same text in a TextBlock within the user control?
If you are careful about the font and positioning of the TextBlock, the text on the resulting background image can appear indistinguishable from text displayed from the Title property. I decided to follow this strategy myself. I found the font information in the following answer:
Font size and family for a tile's title
Otherwise, could you post an example of the XAML you are using?

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.

What type of annotation (or other object) to use?

I'd like to take an existing PDF and add semi-transparent rectangles on top of the pages, at pre-defined locations. When the user moves the mouse over the rectangle, it should change color and/or transparency. I should be able to define different colors (including transparency) for both states. Clicking on it executes some action that I define (such as going to another page, or a website).
I understand that this can be done with annotations, but I'm having trouble figuring out which type of annotation would be best suited. They also don't seem to handle transparency very well. Of course, I'm open to using something other than annotations, if need be...
1) That would have to be annotations. If it's clickable-and-does-something, it's an annotation. It could be an annotation on top of some page content, but an annotation must be involved.
2) You can set the appearance of a button to be arbitrary PDF content, including "normal" and "mouse-over" appearances. Note that these appearances aren't available through the Acrobat UI, but can be accessed programmatically from your API of choice at the object level. All appearance dictionaries have 3 different states: "N"ormal, "R"ollover, and "D"own.
To be honest, I've never tried setting a form field's rollover (or down for that matter) appearance, so I'm not sure how well that will work, but the Theory is sound.
What's the difference between theory and practice? In theory, there's no difference between theory and practice. Ouch.
You didn't specify a programming language/os/anything, so it's not possible to give more detail.
Use a button with an ICON appearance and a transparent background. The icon is an arbitrary PDF content stream with resources. Within it, you can set transparency just like you would as part of a page content stream. In fact, the only way the acrobat gui lets you pick an icon is to select a page from an existing PDF document.
Alternatively you might also be able to set the widget's /DA to use transparency with an extended graphic state resource that you'd add to the Acroform's DR dictionary. I haven't tried that myself.

Superimposing PDF pages

I am trying to superimpose two pdf pages; one on top of the other. I am using Cocoa and the PDFKit framework. When I superimpose the second page onto the first, the second page covers the content of the first page entirely (so the first page is no longer visible). Is there a way to change the transparency of the second page so that its background is fully transparent so that the page underneath it is visible?
Thanks.
EDIT: Here is my method. Create a subclass of PDFPage that holds an instance of another PDFPage and in the following method of the PDFPage class, draw the superimposed page.
- (void)drawWithBox:(PDFDisplayBox)box
{
[super drawWithBox:box];
[overlayedPage drawWithBox:box];
}
Your code may be fine.
It can be caused by the PDF itself if it does have a non-transparent (white) background.
I would first try to operate with 2 PDFs that have "known good" (transparent) backgrounds, like most PDFs have.
You can easily check enable Acrobat Reader to show transparent background as a non-white raster. Use the settings dialog to achieve this:
This page has a background that is transparent. However, the white box's background is... white.
If your page background is non-transparent and white, the Reader would display all the page background in white.
You might want to try rendering the PDF into a bitmap to be displayed in a Core Animation layer. Then you can set the transparency of the layers to whatever you need.