ElementWriter.Begin page_coord_sys

Q:

We are attempting to edit a page content stream using ElementWriter’s WriteMode. e_replacement. In the simplest case we are retaining all of the existing content (i.e. not modifying or adding any new elements - only writing the existing ones as-is). This works in most cases, but when a page has a the Rotate key set, the output content ends up being rotated incorrectly. When we set the optional “page_coord_sys” parameter to False for ElementWriter.Begin(), that seems to resolve the problem in all of our test cases. Can you please explain why the default value for the page_coord_sys parameter is True when it appears that False seems to provide the desired result in all cases? I’m assuming it was done this way because when the average user is adding new content to a page (as opposed to retaining/editing existing content) with the Rotate flag set, True makes it simpler for them to specify coordinates? Are there any drawbacks to setting it to False in our scenario (i.e. editing existing content)?

A:

This option (page_coord_sys in ElementWriter.Begin()) was added to simplify work with different coordinate systems. Some users prefer to add content in page coordinate system, other would like to use (PDF user coordinate system). We originally offered only user coordinate system (since you can transform coordinates to page coord system on your own), however this was causing lots of confusion (especially when adding/stamping new content).

There is no real downside to using either of these options. Which one you use would depend on the type of PDF manipulation required on your end .