Home
Virtual Image Printer DriverMiraplacid Publisher converts documents to images
Virtual Text Printer DriverMiraplacid Text Driver extracts text from documents
Miraplacid Data ViewerMiraplacid Data Viewer - access to internal structure of a binary file
Miraplacid Text ViewerMiraplacid Text Viewer - access to internal structure of a text file
Common:   Login | Rules of forum | Register
Management:  New topic | Close topic | Move topic | Delete topic
  

Miraplacid Forum >> Virtual Printer Drivers >> Miraplacid TextDriver 2009 SDK - Rewind JobModerator:Cerberus

Author Topic:  Miraplacid TextDriver 2009 SDK - Rewind Job
mpl_schorsch
Member

From: Austria
posted 2008-09-30 05:34:11 Reply -Delete

Hi all,

I need to print a Document to PlainText first, then once more to Formatted Text.

Could someone please help me figure out how to Rewind and Restart the Print Job with the new Format Setting?

Thx in advance

Cerberus
Moderator

Web-page
Email
posted 2008-09-30 06:45:28 Reply -Delete

You do not need to rewind the job, because MTD allows you to save every page directly, by number with SavePage() method which receives a number of page as a parameter.

1. Format="Plain";
2. SavePage(0)
3. Format="Formatted"
4. SaveAllPages()

OR,

1. Format="Plain"
2. SavePage(0)
3. Format="Formatted"
4. TransportParam("File","append") = 1
5. SavePage(1) ... SavePage(RenderedPages)
6. CancelJob()

if you do not need to have the first page to be saved twice.

mpl_schorsch
Member

From: Austria
posted 2008-10-06 14:35:30 Reply -Delete

Hi all,

I have a customer that would need a Text Driver API solution (C#) for a 15+ Clients Installation.

The solution is almost finished, apart from a slight but important problem:

- Formatted Text Output "swallows" some of the white-space
- Plain Text Output "swallows" all of the Positioning, but leaves the white-space in the important places where it belongs.

My plan:
1. Print to Plain Text
2. Extract the pieces containing the important white space
3. Rewind the job
4. Print to Formatted Text
5. Replace the Bits with the missing white space with the results of Step 2

The concept is fully coded, only step 3 is missing ... since this functionality is there in the Regular Text Driver GUI, this cannot be much of a problem for your developers.

If you could please help me out with this problem, I can promise you an order within the next 1-2 weeks :-)

Best regards, hope to hear from you soon.

- GeorgHi all,

I have a customer that would need a Text Driver API solution (C#) for a 15+ Clients Installation.

The solution is almost finished, apart from a slight but important problem:

- Formatted Text Output "swallows" some of the white-space
- Plain Text Output "swallows" all of the Positioning, but leaves the white-space in the important places where it belongs.

My plan:
1. Print to Plain Text
2. Extract the pieces containing the important white space
3. Rewind the job
4. Print to Formatted Text
5. Replace the Bits with the missing white space with the results of Step 2

The concept is fully coded, only step 3 is missing ... since this functionality is there in the Regular Text Driver GUI, this cannot be much of a problem for your developers.

If you could please help me out with this problem, I can promise you an order within the next 1-2 weeks :-)

Best regards, hope to hear from you soon.

- Georg

Cerberus
Moderator

Web-page
Email
posted 2008-10-07 00:36:01 Reply -Delete

Hi again.

You do not need to rewind the job. This is not a "tape", this is a "disk".
Every page is available for saving directly by its index.
So, you may save the first page with one output type, change output type and save remaining pages with "append" turned on as provided above.

mpl_schorsch
Member

From: Austria
posted 2008-10-07 06:23:37 Reply -Delete

sorry, i did not want to post this again, was an error of excessive copy/paste .... simply delete it from the thread please

my initially planned post:

thanks for your answers!

what's still open for me: can I achieve this without having to save the pages to disk? background: the result of the combination will be a html page that goes directly to the physical standard printer.

to the point: can i access page contents "in memory" after having rendered all of them?

mpl_schorsch
Member

From: Austria
posted 2008-10-07 12:20:31 Reply -Delete

Hi again,

I have now tried to achieve my desired result by catching the allpagesrendered event (mtd.Format set to "Plain"), then reading the necessary field values from the Plain Text result. Works fine. After that I set mtd.Format to "Formatted" and call GetPage(i) for all the Pages again .... the result stays in the "Plain" manner.

Sorry, obviously I'm blocked from getting this done correctly!

Cerberus
Moderator

Web-page
Email
posted 2008-10-08 04:35:09 Reply -Delete

We have reproduced the situation with help of standard UI.

1. Save the first page in Plain Text format.
2. Change output format to "formatted text". UI does the same as described in manual - put_Format("Formatted").
3. Set "append" checkbox to "on" in File transport options.
4. Save the second page as formatted, appending to previous result (click to "Save" button.

The same will be if you reproduce the situation with your software.
There are no "hidden" methods or properties in MTD.
This is an "open-interface" software.

mpl_schorsch
Member

From: Austria
posted 2008-10-08 08:14:34 Reply -Delete

Sorry, obviously I did not express myself properly.

I do NOT want to save the Page/s, I just need the contents in memory.

The same thing that happens in the standard UI's preview as soon as you change formats. The text there will also change e.g. from Plain Text to Formatted Text, without having to save anything in between.

That's exactly what I would need!

I'm not looking for hidden methods, just for the appropriate one's ;-)

I am using the API with C# (Visual Studio 2008), if that is of importance.

Cerberus
Moderator

Web-page
Email
posted 2008-10-08 08:48:57 Reply -Delete

Unofrtunately, it is imposible to keep two different output type results in memory.
So, you may save the resulting file(s) on disk, and then process this file in your post-processor

http://www.miraplacid.com/mtd/doc/scripting.shtml#postprocessing

You may control saving process if you will provide your own user interface.

mpl_schorsch
Member

From: Austria
posted 2008-10-08 17:54:13 Reply -Delete

hmmmm..... somehow it does not work out. I stepped back to the .net Example provided with the SDK installation and added no more than two lines:

private void b_save_all_Click(object sender, EventArgs e)
{
mtd.set_TransportParam("File", "filename", t_file.Text);
mtd.set_TransportParam("File", "path", t_dir.Text);
m_saving = true;
mtd.SaveAllPages();
mtd.set_TransportParam("File", "append", 1);
mtd.SaveAllPages();
}

...just for having a chance to try the multiple "SaveAllPages" calls...

Unfortunately I get an exeption "Busy: processing is in progress". I even tried putting in a one-minute break .... no luck.

Is .net the wrong choice???

Cerberus
Moderator

Web-page
Email
posted 2008-10-09 03:43:50 Reply -Delete

Unfortunately, this example will not work in any case.
Because SaveAllPages saves all the job and cancels job automatically, then MTD tries to load a new job.
Calling Save... methods is prohibited during saving process.
Since you called SaveAllPages, you will get "Busy", then "No job", when the job will be cancelled.
The best way could be to build a custom UI (not necessary having real user interface components) and catch Progress events.
And, you will need to save page-by-page, or SavePage(0) and SaveAllPages.

Cerberus
Moderator

Web-page
Email
posted 2008-10-09 08:24:47 Reply -Delete

It looks like you have a possibility to still keep results in memory.
You may use GetPage method after each output type applied and save this information by yourself.
Among other things, this will allow you to avoid problems with asyncronous Save... methods.

mpl_schorsch
Member

From: Austria
posted 2008-10-09 10:19:27 Reply -Delete

Thanks, I worked it out now .... hopefully the customer likes the solution ;-)

Your message:
Name, password:
Go to category:  

Technical Support

Copyright © Miraplacid, 2003 - 2024