VBA inserting form fields, different positions result for different users.
I'm certianly at a loss for wrapping my head around this.
Adobe Acrobat 9 Standard (v 9.5.4)
Excel 2010 (VBA)
The problem: When I create the PDF document from Excel, I search for a string of text in order to capture the Quads for the containing rectangle. Then I use the quads to insert a control with numeric offsets. The problem that I am facing is that the offsets seem to be causing the controls to be in different locations for different users. For example, when I send (-26, -2, 100, 10) {x-offset, y-offset, width, height}; the control aligns exactly where I want it. But when another user user runs the exact same routine, or opens the PDF that I created, the fields are no longer positioned correctly.
Is there some setting that I am missing? EDIT, SOLVED: My Acrobat had a custom point to pixel setting. (Preferences > Page Display > Resolution)
Private Function makePdfControl(ByVal pdfPage As Integer, keyTerm As String, Optional ByVal keyTermLookAhead As Integer = 0, Optional ctrlType As String = "text", Optional cCoords As Variant = 0)
'pdfPage is the target page of the document
'keyTerm is the assembled search term: "Date Shipped >> DATESHIPPED"
'keyTermLookAhead is the number of words assembed into KeyTerm, zero based: "Date Shipped" >> "DATESHIPPED" >> "DATE" = 0, "SHIPPED" = 1
'ctrlType determines the type of control to place on the form; default is text
'cCoords carries an array of integers: x-offset, y-offset, width, and height
txt = ""
Dim fkt As Integer 'counter for keyTermLookAhead
Dim matchFound As Boolean 'flag that a match has been found
Dim maxWords As Integer 'the maximum number of words in pdfPage
Dim coord(3) As Integer 'local array container to provide interface for cCoords
p = 0
matchFound = False
maxWords = jso.getPageNumWords(pdfPage)
Do While p + keyTermLookAhead <= maxWords 'search all words in the target page; break if not found
p = p + 1
For fkt = 0 To keyTermLookAhead
txt = txt & jso.getPageNthWord(pdfPage, p + fkt)
Next fkt
If UCase(txt) <> UCase(keyTerm) Then 'the assembly of terms is complete, check if match
txt = "" 'prepare "txt" for next assembly
matchFound = False
Else
matchFound = True 'we've struck gold, exit the loop preserving val of "p" as the first word in the assembly
Exit Do
End If
Loop
If matchFound = True Then
Dim qtmp() As Variant
Dim q(7) As Double
qtmp = jso.getPageNthWordQuads(pdfPage, p)(0) 'collect the rectangle containing the first word of the search; output is a base-0x7 array
For a = 0 To 7
q(a) = qtmp(a) 'collect the data
Next a
If VarType(cCoords) <> 8204 Then '8204 means that we've inserted an array into the Varient type var cCoords
coord(0) = 0
coord(1) = 0
coord(2) = 100
coord(3) = 15
Else
coord(0) = cCoords(0) 'x-offset value
coord(1) = cCoords(1) 'y-offset value
coord(2) = cCoords(2) 'width value
coord(3) = cCoords(3) 'height value
End If
x0 = coord(0) 'x-offset var
y0 = coord(1) 'y-offset var
w = coord(2) 'ctrl width
h = coord(3) 'ctrl height
x = q(0) + x0
y = q(7) - h + y0
'origin point of doc matrix is lower-left corner
'origin point of control is lower left corner of the rectangle containing the first word of the search phrase
'offsets are placed from this point, negative x shifts to the left, negative y shifts down
'values are in points, not pixels
Set f = aForm.Fields.Add(keyTerm, ctrlType, pdfPage, x, y, x + w, y + h) '(uplf, lwlf, lwrt, uprt) 'add the control to the form using values passed in
End If
End Function
The above function is used while looping through the pages of the created PDF document. I am using the following function to create the document from Excel:
Private Sub exportToPDF()
DoEvents
Application.ScreenUpdating = False
Call showTabs(False)
ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=pdfPathData, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=False, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Call showTabs(True)
Call locateDoc
Application.ScreenUpdating = True
End Sub
Message was edited by: ilivingston: solved
Thanks for the reply, I did spend some time working on this issue... here is what I found...
1) First of all, I did have a custom Points to Inches setting in my Acrobat options... 110 vs 96. Resetting this allowed for me to see the alignment issue that my colleagues were referencing first hand.
As it turned out, my results were better, but still had inconsistency among different workstations. Leading me to..
2) The MSFT creator uses the default printer in some way to create the PDF. Because the different workstations were using different printers, we were getting different results. If everyone used an HP 1320, nobody would see any difference upon creating / adding fields.
The final solution was to change the Application.Printer to a common network printer before the export operation, and return the Application.Printer to the user default after the export completed. This has provided us with a common ground to work upon; we are lucky to have a network printer that can be used for this purpose, as I can see this becoming non-viable in environments where this would be unavailable.
Similar Messages
-
I have created a form that contains fields with default text for a user to update/personalize. Is there a way to style the text so I can quickly identify changes to default text in a field?
George - Thanks you so much! Actually, i'd love for the text color to be red font color. Could you send me the script for that? And I assume I just copy and paste the script into the field properties (see screenshot)?
thanks again!
Seth -
Different zoom levels for different clips in the same project?
Hi
I am making a movie with videos from two different cameras. As a result some of the clips are cut down in size to a small portion of the screen. This can be solved if it is possible to use different zoom levels for different clips in the same project. I have not been able to do this. Is it possible?
kind regards
SorenYou can scale the small clips up to the same size of the larger one... but you will get a quality loss.
Using Motion or Scale to Frame Size commands
Better to scale the large ones down to a Sequence that matches the smaller clip dimensions. -
Different Number range for different objects
HI Gurus
Could you please explain how can we make different Number range for different objects(O,S,P).Can we do with standards or we can go for UserExit??.
Your early Advise will be appreciated.
Thanks
ChandraHi Chandra,
SM31 -> T77IV : 01S -> Number Range Maintenance.
(or SPRO -> Pers Man -> Org Man -> Basic Settings -> Maintain Number Ranges)
For the subgroups
01C (plan variant 01, Object type C) Job
01O (plan variant 01, Object type O) Org unit
01S (plan variant 01, Object type S) Position
Define the following number ranges respectively.
(EX 60000000 69999999)
(EX 70000000 79999999)
(EX 80000000 89999999)
Regards,
Dilek -
<i>I am using NAS 4.1 and was wondering is it possible to set a different session timeout for different users?</i>
Um, there is no such thing as NAS4.1.
I'm assuming that you mean NAS4.0 (maybe NAS4.0sp1?). If so, then the session timeouts are specified in the session section of the NTV configuration files.
AFAIK, you can specify session timeouts on a per user basis. -
Different Cost Centers for Different Line Items in a single Reservation
Hello Gurus,
When we create a Material Reservation, we give the cost center at the header level and that cost center is accounted for each of the line items in the reservation. But when the reservation has many line items which depend on different cost centers, there is a need to enter different cost centers for different line items in the same Material Reservation. How can this be done? Please suggest.Hi,
It's a standard restriction in SAP functionality where one reservation document can only accommodate one cost center.
You can not maintain multiple cost centres for individual line items.
You have to create seperate Reservations for each cost centre.
check below thread:
ONE RESERVATION FOR DIFF COST CENTERS
Umakanth R
Edited by: Umakanth R on Dec 8, 2011 7:53 AM -
JTree: How to set different cell editor for different tree Nodes.
I have a JTree and I want to set different cell editors for different node depending on some condition. E.g. I want to set ComboBox as editor for leaf node but each leaf node will have its own set of data.
Any help or pointer?
Thanks in advance
Sachintake there:
http://www.mutualinstrument.com/Easy/FAQ/Tree/tree.html -
So how to specify different answer file for different install images in WDS snap-in?
hello
in WDS snap-in, in properties on server name, on client tab, we can define an answer file for unattended windows installation on WDS clients.
my question is, maybe we have added multiple images in WDS snap-in (win xp image, win 7 , win 2008,...)
now this one answer file applies to all of them ?
so how to specify different answer file for different install images in WDS snap-in?
thanks in advancedUnder the "Client" tab of WDS, you should only use an answer-file with settings relevant for the installation. This would be credentials for the WDS deployment share, international settings used during the setup and possibly also destination drive
details (if you want the installation to take care of partitioning the disk etc). The settings relevant for unattend-files used under "Client" would only be of those in phase 1 (WinPE).
However, if you would like to have specific unattend file for every installation, e.g. Win7, Server 2008, Win 8 etc, you can browse to the image under "Install Images" under the image Groups. There you can select properties for every image and
have a personal unattend-file.
hi Joel
very cool. thanks a lot, that really helped me.
best regards -
Different mail ID for different workflows
Hi All,
As per my knowledge if we use mail task in work flow a e-mail will be triggered from mail ID maintained for user wf_batch , is there any way to send mail through different mail iD for different workflows by using mail tasks only, not by using a separate task and using some function modules in that to send mails.
Thanks
VinodHi,
I have done this once. It is not the best I admit as many things must be considered, yet it worked.
In the binding of an activity step, prior to the mail send step, I have included the calling to a custom FM.
In this FM I have dinamically changed the mail address of WF-BATCH (the address was set in an ad-hoc paramenter.
Then right after the mail send step, again in the following binding, I have run the very same FM, with different paramenters of course, to put the address back to where it was.
Corrado -
Java.util.logging - different log files for different loggers
I'm having trouble configuring Java logging to use different log files for different loggers.
In log4j, I would do this by configuring multiple loggers each with a different appender. But how can I do this with Java (java.util.logging) logging?
This is the basic idea of what I'd like to do:
com.mycompany.app1.level = FINEST
com.mycompany.app1.<log file> = logfile1.log
com.mycompany.app2.level = ALL
com.mycompany.app2.<log file> = logfile2.log
Any suggestions?This kind of thing?
import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;
public class LogTest {
private Logger app1;
private Logger app2;
public LogTest() {
// setup loggers
try {
// first logger
app1 = Logger.getLogger("com.mycompany.app1");
FileHandler filehandler = new FileHandler( "logfile1.log" );
filehandler.setFormatter(new SimpleFormatter());
app1.addHandler(filehandler);
// second logger
app2 = Logger.getLogger("com.mycompany.app2");
filehandler = new FileHandler( "logfile2.log" );
filehandler.setFormatter(new SimpleFormatter());
app2.addHandler(filehandler);
} catch(IOException ioex) {
ioex.printStackTrace();
private void logStuff() {
app1.log(Level.SEVERE, "a message for log 1");
app2.log(Level.SEVERE, "a message for log 2");
app2.log(Level.WARNING, "another message for log 2");
* @param args
public static void main(String[] args) {
new LogTest().logStuff();
} -
Btrfs with different file systems for different mount points?
Hey,
I finally bought a SSD, and I want to format it to f2fs (and fat to boot on UEFI) and install Arch on it, and in my old HDD I intend to have /home and /var and try btrfs on them, but I saw in Arch wiki that btrfs "Cannot use different file systems for different mount points.", it means I cannot have a / in f2fs and a /home in btrfs? What can I do? Better use XFS, ZFS or ext4 (I want the faster one)?
Thanks in advance and sorry my english.pedrofleck wrote:Gosh, what was I thinking, thank you! (I still have a doubt: is btrfs the best option?)
Just a few weeks ago many of us were worrying about massive data loss due to a bug introduced in kernel 3.17 that caused corruption when using snapshots. Because btrfs is under heavy developement, this sort of thing can be expected. That said, I have my entire system running with btrfs. I have 4 volumes, two raid1, a raid0 and a jbod. I also run rsync to an ext4 partition and ntfs. Furthermore I make offline backups as well.
If you use btrfs make sure you have backups and make sure you are ready to use them. Also, make sure you check sum your backups. rsync has the option to use checksums in place of access times to determine what to sync. -
Design: different AP Groups for different SSIDs?!
Imagine I have different requirements for the AP Groups for different SSIDs
I suppose I can't have different AP Groups for different SSIDs?!
Imagine I have to many Clients to use one single VLAN for one SSID. So I will use AP Groups.
For SSIDâXâ
Let's say I have 5 buildings with 800 Users, so I make a AP Group per Building and tell those APs that they are in that group.
For SSIDâYâ
All though I have this SSID also in all 5 buildings, I only have very view Users, so I could make one single VLAN which makes everything easier.
Am I obligated now to create 5 VLANs for SSIDâYâ too?!
*This is a made up example. In reality I would make different numbers of AP Groups for different SSIDs because I have significantly different number of Clients⦠and traffic characteristics (more or less broadcast).
But it's also about the size of the VLANs, do I make a view large Broadcast Domains (VLANs) or more small ones.
Greetings, AndiYou can have a setup like this if you want:
AP Group 1
SSID X Vlan 10
SSID Y Vlan 21
SSID Z Vlan 31
AP Group 2
SSID X Vlan 10
SSID Y Vlan 22
SSID Z Vlan 31
AP Group 3
SSID X Vlan 10
SSID Y Vlan 23
SSID Z Vlan 32
AP Group 4
SSID X Vlan 10
SSID Y Vlan 24
SSID Z Vlan 32
AP Group 5
SSID X Vlan 10
SSID Y Vlan 25
SSID Z Vlan 33
AP Group 6
SSID X Vlan 10
SSID Y Vlan 26
SSID Z Vlan 33
Here is a link, which you probably already saw.
http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configuration_example09186a008073c723.shtml -
Hello all,
I want to create or update multidimensional freight conditions for different scale id for different conditions.
I cound not find any Bapi or FM for this. I uesd BDC for this but i can not rely on it.
If any one have other solution than IDOC then suggest me.
Any BAPI or FM available then suggest me.Hi Gowri Rao,
Can you please tell me, what values do you pass in table 'IT_PRICING_CONDITIONS'?
Regards,
Pratik -
Different item arrangements for different folders... possible?
Hi.
I have some folders i need arranged in date added, and others in 'name'.
It seems that when i change it for one it changes it for all.
Is it possible to have different item arrangements for different folders?
ThanksYes.
-
Different ring tones for different email accounts
Is it possible to set different ring tone for different email accounts?
No - but you can change the sound for the email the notification in the settings .... Settings>General>Sounds>New Mail> and select another sound from the list, but that will use the same sound for all of your email accounts.
Maybe you are looking for
-
I automatically back up my hd and now can't use my itunes library... Help!
I started using a Lacie external hd to automatically back up my hard drive using the time machine application. however, now when I try to play the music from my itunes library (or anything else for that matter) I get a message saying: "it can not be
-
I need a white outline around a movie character, and animate it. Like song 'Stacys Mom'
In the music video Stacys mom by Foundations of Wayne, theres pictures on the wall of a band playing, with shaky white outlines around their bodys, i want to create this effect around actors / band members in my movie . http://www.youtube.com/watch?v
-
Document types Doc status RU can not reach OB or FR - IMG configuration
Hi A new document status which comes after FR has to be created. I did this but when I create a new document in CV01N, and changed the status until I reach RU, the status which I configured in IMG ánd which is the one before FR, can not be seen and
-
Hi everyone just signed up to this forum today, really need help, would appreciate your help. Basically I have created 5 buttons on one single layer. I am now trying to link each button to a website, but to no success as of yet. I realised that maybe
-
Where can I find airport card or airport extreme card
I want to make my g4 wireless where can I find these cards to do so? Any recommendations to purchase them? Thanks in advance