petersoftware

Does anyone know whether there is a page limit in an XPS document I have created a 10,000 page XPS document printed with the Microsoft XPS Document Writer from Crystal Reports XI. I can open this document in the XPS viewer with no problems.

However, when I create a 100,000 page document using the same package, the XPS document does not open in the XPS viewer and the memory use on my computer jumps and keeps on rising.

I am working on Windows XP. Any ideas, anyone



Re: XML Paper Specification (XPS) Page Limit?

CTA

Hi,

Spec says max. number of fixed pages in a fixed document is 1,000,000. But if your xps document is created in interleaved (default, document writer creates in non-interleaved), zip32 has a limitation on item count.
Try creating document in non-interleaved and see. it is possible still you may have the problem because of zip limitation.






Re: XML Paper Specification (XPS) Page Limit?

petersoftware

Thank you CTA,

This information is very useful. In further tests I was able to print upto 30,000 pages using the MXDW in non-interleaved format. I will need to look at the zip32 limitation. My document is quite simple though (1 logo on each page (same logo on each page), an address and 3 paragraphs of text on each pages), so I am a bit worried if this proves to go beyond a limit.





Re: XML Paper Specification (XPS) Page Limit?

Jo0815

did you also see that massive memory usage when printing your 10,000 page XPS file


I have tried to print 5,000-10,000 Visuals via the Visuals-batchwriter and I've got ~2gig of swapfile size and ~1gig for the process... and it got slower and slower when printing to a legacy printer...
and it even "crashed" and just rebootet the pc (guess it was a BSOD because of OutOfMemory) sometimes... (though the pc got 2GIG RAM and 2GIG swapfile)

I'm not sure why they eat up that much memory, I've also asked MS about that, but the support didn't have an acceptable answer for that behaviour actually, so I think it might be a "bug" !

did you have same behaviours




Re: XML Paper Specification (XPS) Page Limit?

CTA

Hi Jo,

I have not tried more than 300 page document,

Is it graphics intense document if not, is it possible that visuals are not cleaned up properly after printing each page. I have seen that massive memory usage for graphics intense pages.






Re: XML Paper Specification (XPS) Page Limit?

Jo0815

Hej Charlee ,


no it wasn't graphics intense pages - just some tables and text... it was a simple word-documents, which I have printed for my test to XPS before... then I just have loaded each FixedPage, merged it with another Visual (as some kind of overlay) and printed it via the visuals-batchwriter on a legacy printer...

I have also checked if I could free some objects on my own (or try to force the GC), but the most objects doesn't have a dispose() method, so I assume there must be a bug in XPS not cleaning up properly after printing each page... (even a Microsoft support guy said he can reproduce the behaviour, but he had no clue why it is like that...)

on my test app I just printed one fixedPage/Visual (without merging it with another visual) and I saw memory increased by ~5MB each time I pressed the button... and the memory doesn't get freed... :-/

not very funny you can guess yourself, as I need to print up to 50,000 pages for example...
also the heavy RAM usage ofcourse drops down the printing-speed the more it eats up (also that damn "c:\temp\ouput.xps"-port is a performance killer - but I have to use it as something like the StartDoc-Api is missing in XPS-PrintPath)...

regards,
Jo




Re: XML Paper Specification (XPS) Page Limit?

petersoftware

Jo0815,

When I am printing large files I am not seeing the increase in memory. Although I am having the problem mentioned eariler about opening files over 30,000 pages. The code I am using to print is below. I hope that this helps.

Dim vxpsd As System.Windows.Documents.Serialization.SerializerWriterCollator

vxpsd = xpsWriter.CreateVisualsCollator

vxpsd.BeginBatchWrite()

objXPSPage = New System.Windows.Documents.FixedPage

objXPSPage = objXPSDocumentPage.Visual

' The next line adds a FixedPage and applys it and an "overlay" into a ContainerVisual

objNewPage = objMarkupPage.Apply(objXPSPage)

Dim objPrintTicket As New System.Printing.PrintTicket

' Set Duplexing On Page By Page Basis
Select Case lngDuplexingType
Case 1
objPrintTicket.Duplexing = Duplexing.OneSided
Case 2
objPrintTicket.Duplexing = Duplexing.TwoSidedShortEdge
Case 3
objPrintTicket.Duplexing = Duplexing.TwoSidedLongEdge
Case Else
objPrintTicket.Duplexing = Duplexing.Unknown
End Select

objPrintTicket.InputBin = New InputBin

objPrintTicket.InputBin = 1

vxpsd.Write(objNewPage) ' , objPrintTicket)

objNewPage = Nothing

xpsOld.Close()

vxpsd.EndBatchWrite()





Re: XML Paper Specification (XPS) Page Limit?

Jo0815

Hej,


I do printing the same way you do using the SerializerWriterCollator and ContainerVisual...
but I guess the difference is that I'm loading each xps-file seperatly and print the FixedPages then, instead of loading 1 big xps-file and iterating over all the pages...

anway, thanx for your informations and reply...
regards,
Jo






Re: XML Paper Specification (XPS) Page Limit?

Jo0815

I found the reason for that huge memory usage when printing lot's of visuals via the visuals batchwriter...


If you use Measure/Arrange calls on the FixedPage then you MUST call UpdateLayout also, else this leads to big memory-leaks!!!

I was wondering about that as according to the SDK-help this function shouldn't be called or is in most cases unnecessary to call... so I assume the help-file is a bit misleading on that!!!




Re: XML Paper Specification (XPS) Page Limit?

petersoftware

Back in January I was unable to create a 100,000 page XPS document using the Microsoft XPS Document Writer (see first message in this post). Replies to this post informed me that there was a limit, but this is 1 million pages. I was only at 10% of this. I have now got a Vista test machine with full Vista Business installed. I still cannot produce a 100,000 page XPS document using the Microsoft XPS Document Writer. I cannot believe this, as we have invested a lot of resource in developing software for this XPS document format.

Has anyone got any ideas or has anyone successfully created a large XPS document

Help Me Please...





Re: XML Paper Specification (XPS) Page Limit?

Canderson

We now too are experiencing the same problems with an upper page limit.

The XPS document page writer seems to max out at around the 30,000 page limit. This is causing us a great deal of concern as our customer has a variable amount of pages from one job to the next. Although rare, they have quoted requirements of 50k +

We have tested this both on XP and Vista.

It would help us a great deal if someone from the team could give us specific numbers on the upper page limit and any time scale for correction.

Thanks...




Re: XML Paper Specification (XPS) Page Limit?

Feng Yuan - MSFT

The problem you're experiencing is a bug in the implementation, not the limitation of XPS format itself. This will be considered for a future release. If you're blocked by this issue, try to write or find a tool which can repair ZIP files.

Thanks






Re: XML Paper Specification (XPS) Page Limit?

Canderson

Well after a quick investigation I am not sure if the xps/zip file is recoverable. I got a copy of the zip repair tool from the following website: http://www.zip-repair-tool.com/

The tool ran through the file quite happily. But, the page number it reached was 3,813 of a 50,000 page file.

Below is the log output showing the final stages:

Scanning Zip file. Offset: 0x00000000004FF97F
Local header found. Offset: 0x00000000004FFA89
Checking found header...
Valid header. Found item name: Documents/1/Pages/3812.fpage
Starting rebuilding process.
Analyzing found item. Please wait...
The item is valid and can be repaired. Calculating CRC. Please wait...
CRC: 0x00000000
Finishing rebuilding process...
Done.

Scanning Zip file. Offset: 0x00000000004FFAC3
Local header found. Offset: 0x00000000004FFE83
Checking found header...
Valid header. Found item name: Documents/1/Pages/_rels/3813.fpage.rels
Starting rebuilding process.
Analyzing found item. Please wait...
The item is valid and can be repaired. Calculating CRC. Please wait...
CRC: 0x00000000
Finishing rebuilding process...
Done.

Scanning Zip file. Offset: 0x00000000004FFEC8
Local header found. Offset: 0x00000000004FFFD2
Checking found header...
Valid header. Found item name: Documents/1/Pages/3813.fpage
Starting rebuilding process.
Analyzing found item. Please wait...
The item is valid and can be repaired. Calculating CRC. Please wait...
CRC: 0x00000000
Finishing rebuilding process...
Done.

Scanning Zip file. Offset: 0x000000000050000C
End of file reached.

In addition, the file repair process takes a substantial amount of time to complete (as well as cpu resources), as all the pages in the document have to be checked, not just the corrupt pages.

This is causing us a great headache and is blocking potential sales as we can't commit. If Microsoft are going to fix the broken XPS writer how long in the future must we wait

Has anyone actually proven that a 50,000 page document can be successfully written and opened




Re: XML Paper Specification (XPS) Page Limit?

Feng Yuan - MSFT

Try this small piece of repair code:

NOTE:

1) This only works for this case (file with lots of pages generated by MXDW).

2) The original file is over-written, so make a copy of it before using it.

int ZipRepair(const wchar_t * pFileName)
{
HANDLE hFile = CreateFile(pFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

if (hFile == INVALID_HANDLE_VALUE)
{
return -1;
}

DWORD sizeHigh;
DWORD sizeLow = GetFileSize(hFile, & sizeHigh);

DWORD buffer[25];

DWORD read = 0;

if (SetFilePointer(hFile, sizeLow - 22, NULL, SEEK_SET))
if (ReadFile(hFile, buffer, 22, & read, NULL))
{
DWORD entry = (buffer[2] & 0xFFFF) + 0x10000;
DWORD size = buffer[3];
DWORD offset = buffer[4];

memset(buffer, 0, sizeof(buffer));

buffer[0] = 0x06064b50;
buffer[1] = 44;
buffer[3] = 0x002d002d;
bufferDevil = entry;
bufferMusic = entry;
buffer[10] = size;
buffer[12] = offset;

buffer[14] = 0x07064b50;
buffer[16] = sizeLow - 22;
buffer[18] = 1;

buffer[19] = 0x06054b50;
buffer[21] = 0xFFFFFFFF;
buffer[22] = 0xFFFFFFFF;
buffer[23] = 0xFFFFFFFF;

if (SetFilePointer(hFile, sizeLow - 22, NULL, SEEK_SET))
{
if (WriteFile(hFile, buffer, 98, & read, NULL))
{
printf("%S repaired\n", pFileName);
}
}
}

CloseHandle(hFile);

return 0;
}

Thanks for pushing the limits

Feng Yuan






Re: XML Paper Specification (XPS) Page Limit?

Feng Yuan - MSFT

The two lines with funny icons should have been:

buffer[ 6 ] = entry;
buffer[ 8 ] = entry;