Print Page | Close Window

Make image transparent and text opaque

Printed From: Debenu Quick PDF Library - PDF SDK Community Forum
Category: For Users of the Library
Forum Name: I need help - I can help
Forum Description: Problems and solutions while programming with the Debenu Quick PDF Library and Debenu PDF Viewer SDK
URL: http://www.quickpdf.org/forum/forum_posts.asp?TID=3233
Printed Date: 29 Apr 25 at 10:31AM
Software Version: Web Wiz Forums 11.01 - http://www.webwizforums.com


Topic: Make image transparent and text opaque
Posted By: GMahler
Subject: Make image transparent and text opaque
Date Posted: 19 Dec 15 at 5:02PM
Hey,

I'm very new to Quick PDF Library and I'm not yet having a grip to the vast set of functions.

I have a PDF that comes from Nuance OCR. It has one image per page and invisible but selectable text (the OCR text). Nuance calls this "text over image". I'd like to do the following:

- Make the image transparent (about 20%)
- Make the text visible/opaque

The reason for this is that I want to check the quality of the OCR by being able to directly compare the recognized text to the image. That's why I'd like to see the text.

I've looked through the documention but I haven't found a way to directly manipulate the text or the image transparency. All the methods I found just seem to work "subsequently". Does this mean I have to build a completely new PDF document by copying the contents of my original PDF, image per image, text block per text block, to be able to set text color or image transparency?

I hope not... ;-)

Thanks in advance for enlighting hints.

Georg



Replies:
Posted By: Ingo
Date Posted: 25 Dec 15 at 1:53PM
Hi Georg,

Hi Georg,

your main point is to separate content of pdf-pages.
The page-content can be built on several layers (OptionalContentGroups/OGCs).
One basic layer, the next layer with an image, then a layer with the text content, and so on.
What i wanna say is one approach could be to deal with the layer-functionalities:
http://www.debenu.com/docs/pdf_library_reference/ContentStreamsAndOptionalContentGroups.php
First you should determine the layer count:
Function "ContentStreamCount".
Deleting one layer after the other starting from layer 0 (the first) will delete each layer content showing you the remaining content. What i can image is that the image is on one separate layer and if this layer is deleted you should see any text content...
Try it ;-)

Cheers and welcome here,
Ingo



-------------
Cheers,
Ingo



Posted By: GMahler
Date Posted: 04 Jan 16 at 1:37PM
Hi Ingo,

thank you very much for your answer!

I experimented with the layers/content streams and I got weird results.

ContentStreamCount returns 2, as expected.

When I delete Stream 1, the resulting PDF seems completely empty. No image, no selectable text.

When I delete Stream 2, BOTH are still visible.

In both cases, the size of the resulting PDF is very near to the original, despite one layer should have been removed.

Doesn't "DeleteContentStream" do what it is supposed to do? Or am I misunderstanding some fundamental concepts?

I haven't found more fitting methods in "Content Streams and Optional Content Groups" help page.

Btw: I do not want to delete layers, I'd like to manipulate them as described in my initial post.

Best regards,
Georg


Posted By: Ingo
Date Posted: 07 Jan 16 at 8:36PM
Hi Georg,

you won't get success in changing/modifying a ready-made pdf-document.
What you can do is content-extraction (text and images).
With the extraction then you can build a new document similar to the original one.
BTW: If CombineContentStream was used all content from the different layers will be together.

Cheers,
Ingo



-------------
Cheers,
Ingo




Print Page | Close Window

Forum Software by Web Wiz Forums® version 11.01 - http://www.webwizforums.com
Copyright ©2001-2014 Web Wiz Ltd. - http://www.webwiz.co.uk