iText page number references - reference

I am generating a large document that will have many references to other pages in the document. For instance, the text might say:
"This topic is covered in Chapter 46 (see page XX)."
or
"See the chart on page XX"
Since I don't know the page number ahead of time, my initial thought was to create the PDF in multiple passes, as outlined in "iText in Action", chapter 6. However, as I understand it, this would not work because the PDFStamper cannot edit existing chunks of text once they are created. My second thought is to create the document twice. The first time, I would create the document and simply make a hashmap of referenced places in the text and page numbers. The second time, I would use those to generate references.
Is there a better way to do this?

Create a PdfTemplate as placeholder for all the unknown data, store these in an array.
Mark the referred text with onGenericTag() and fill out the templates stored in the array with the page number.
Main problem: how to define the size of the PdfTemplate? That problem can't be solved.

Related

xPath Namemapping for several dropdowns

I have a button that is dynamic in several webscreens using TestComplete.
I have a buttonKeep object that is successfully implemented in the first screen it goes through the first screen and selects a Word and Excel document copies data up and then I paste it to the website
//div[(contains(#style,'display: block'))]//button[#id='Keep']
OR //div[not(contains(#style,"display:none'))]//button[contains(#class, 'fr-keep-word')]
OR //button[contains(#class, 'fr-keep-word')]
OR //div[2]/div/div/button[2]
OR //div[contains(#style,'display: block')]
Now I will select a screen that will move me on to a series of dropdowns where I will do the same thing in one of the drop downs. The system wants to add a different buttonKeep object everytime I run the test rather than recognized that the item had been mapped correctly earlier. Or even when I selected the first time I run the test.
Any suggestions would be very helpful.
I imagine this issue is due to a dynamic element in the page object. With the page objects being different, that cause the same object to be mapped again.
I would recommend investigating the page objects, and if they are the same page, but with a dynamic section, add wildcard values to account for the dynamic nodes.
To make mapping settings independent of dynamic changes in web page URLs, you can use the asterisk () wildcard in place of the values -- http://www.example.com/index.asp?act=12312&sid=, or in place of the entire query string -- http://www.example.com/index.asp.

Appending text to a RichText item ("Body") is resulting in TWO Body items...why?

An email arrives into a mail-in database. I look at it and see that it has a single Body item, which is Rich Text.
In an agent run after new mail arrives, I want to update the arriving memo, and append some text to that Body item and then save it. I use getfirstitem to get a handle on it, and then use AddNewLine and Appendtext in successive lines of code, adding a bit of text to it, before saving it.
After this is done, I look at the backend document again and where there used to be a single Body item there are now two. Each has a portion of what I expected a single item to have. Between the two, nothing is missing.
Note: The incoming email also has attachments...but it did originally before I updated it and again, there was only one Body item.
Note2: Sending the email from Outlook. How that could be related I don't know.
What could be causing this or what might I do to work around this. Open to all suggestions/ideas.
Thank you
Matt Smith
If you call Compact on the Body after you've finished adding to it (and before saving if you do an explicit save), that might reduce it to a single item, but it's not guaranteed.
There are cases where Body is forced to be 2 or more items. E.g.:
If an email comes in as MIME (which is common for emails from outside your network), each MIME part is always a separate Body item, and there are normally 2 or more MIME parts for a single email.
I think each rich-text item has a strict 64 kB size limit for the raw data, so content exceeding 64 kB will always be 2 or more items, but I'm not sure of this.
As others have said in comments, it's normal to have more than 1 item for rich-text content. You should never have to care about this. If you use GetFirstItem to get a rich-text item and add text to the end of it, it will act like one item from an end-user perspective.
I decided on another way to accomplish what i needed, not appending text, so this question is no longer in need of help, other than to sate my own curiosity. Thanks guys.

Can DocuSign add signature pages dynamically?

I am trying to write a DocuSign integration where a customer uploads a PDF file and sends it to a list of signees. The customer should not have to place the right amount of anchors in the document. Instead, a new page (or several pages if necessary) for signatures should be added to the document automatically, with one signature box per signee. I want to avoid modifying the PDF myself. Is there any way DocuSign can do this for me?
The easiest and best way to do this would be to utilize anchor strings, which you've mentioned above that you would rather not do. Normally under these circumstances I'd recommend using a template, however you've indicated that you want the customer to be able to upload the PDF, correct?
The issue there comes down to document dimensions. If you were using a template, the coordinates for a tab would be stored in the template and be applied automatically. If your customer is supplying a PDF, you don't have a guarantee on how small or large the page dimensions will be. IE: An image taken with a Retina display vs. a 6MP camera would be like a Post-It Note vs. a calendar. The remaining option would be to find a standard set of coordinates that would work. For example, when a customer upload a new PDF always have a signature or initial tab applied at x/y: 0,0 so it will always appear at the top left.
Alternatively, what we would normally recommend is that the customer add in a unique identifier like /signer1signature/, then apply the tab via anchor string where it will be applied at every instance, even if it's a single instance hidden on the signature line.

Best approach to design an infopath form with repeating (but not identical) sections

i'm an InfoPath noob, and i have to prepare a (quite complex) form.
This form is made of two main areas: a summary page and one (or more) "element-specific" page(s).
In the summary page the user must select one or more elements (with a maximum of 4) and fill some data.
When the user selects one of those elements, the form should add the element-specific page related to the selected element.
I have already created both the summary and the element-specific pages (all in a single view...is that bad?) for a single "element-type".
Now i'm having quite a problem. Due to the fact that the element-specific form is quite long and have different fields and validation logics, i really don't want to replicate (copy) all those fields and elements one by one (if i just copy the section, it will have the same field/value of the other element-type).
I have seen the repeating/optional section, but those options doesn't seem to be good for my problem (in the summary page the user must check the element-type in order to enable some data fields that must be filled...and the checked items must be consistent with the sections that are shown. The user cannot add arbitrary sections like in the repeating/optional sections, the form (based on the checked fields) should show the correct sections)
Consider that some small details are different from a specific-section to another (i have to take some values of some fields from a specific section fields in the summary page and change an image) and i don't know how to handle those differences.
Consider also that the final output of this work should be a printable pdf.
Here you can find some images mocking the result of the form:
1) This is the Summary Page:
2) this is a mock of two detail pages. Please note that are the two ones "selected" in the summary.
3) this is a mock of the fields structure of the form:
What i need is in fact to create 4 "mostly identical clone" sections, all with their status and values, with some minor differences from one to another.
Is there any way to achive such result whithout having to create 4 different "sets" of fields, one for each specific element (that would obviously be a big amount of error-prone work)?
Sorry for the long post...hope it was clear enough.
Many thanks in advance
Ok, so i've found a very good solution using template parts. I've designed some template part for the common form sections (following this guide on www.informit.com, then i've added them to the complete form template by building each block using,when needed, the right template part.
Thanks to teylyn for the help (luckly i didn't have to write to a list or use vb or c# code in my template part, only in the main template).

Sharepoint: Image field with a link

I would like to add a field to a list with displays an Image, but acts as a hyperlink. In other words like the "Hyperlink or Picture" column, but "Hyperlink AND Picture" instead.
Where the two fields you input would be the URL to the image to display, and the URL of the hyperlink.
This must be possible. I notice that the Type (in a document library) column does just that, and also includes the views that are currently being used (in the case of a folder).
Is it possible to duplicate the computed Type field in a document library to read two other fields in the list (which will act as the image url, and the redirect link)? What would the CAML be?
Thanks in advance if anyone could offer any insight.
Arnhem
This can be done but you would need to develop a custom field type. As you have found, SharePoint's default rendering for pictures is without the hyperlink. You need to change how the rendering behaves in Display mode in your own custom field. Check Patterns in Custom Field Rendering for more info.
There are also several examples of creating custom field types on the web. The MSDN articles give a lot of detail about how it all works but don't let that put you off as it's not too tricky.

Resources