Ask a Question related to Adobe Acrobat SDK, Design and Development.
-
Michael_O_Dell@adobeforums.com #1
Basic VB.net and Javascript help
I am working on a VB.Net program with the JS interface object. I am trying to use the method addWaterMarkFromText from the JSObj. I can't find good documentation on the variables required as well as constants that can be used. Seems like an easy situtaion. Any pointers?
Michael_O_Dell@adobeforums.com Guest
-
Include javascript in a javascript file
Hello, Is there a way to include a javascript file from WITHIN a javascript file? Something similar as in the "#include" directive in C++? ... -
3D basic
I'm having some problems in 3D basic programming: 1. how can i remove one or more model in a 3D sprite on the stage? 2. how can i get the model's... -
output text in control location; calling control javascript from page javascript
Hi; If you don't know, I'm just learning javascript and aspnet, but I have a pretty good grounding in windows programming. I'm trying to build a... -
Dark basic pro VS blitz basic 3D VS 3d game studio VS shockwave VS jamajic
What are all your thoughts on the other leading 3D indi game creation packages out there? Are there others that I didn?t mention? here are a few... -
need javascript staff (anyone who knows javascript peroid) (READ)
hey its me ultimategamerx and im back in some clothes lol i need some people who know java script i need help please reply if ya know some -
Leonard_Rosenthol@adobeforums.com #2
Re: Basic VB.net and Javascript help
The JavaScript documentation has everything you should need...
Leonard_Rosenthol@adobeforums.com Guest
-
Michael_O_Dell@adobeforums.com #3
Re: Basic VB.net and Javascript help
I already checked it out. It isn't the most descriptive API I have used. How do I get a single instance of App to use the constants that are described in the API?
Michael_O_Dell@adobeforums.com Guest
-
Leonard_Rosenthol@adobeforums.com #4
Re: Basic VB.net and Javascript help
there only is one instance of app...
Leonard_Rosenthol@adobeforums.com Guest
-
Michael_O_Dell@adobeforums.com #5
Re: Basic VB.net and Javascript help
I feel like you know something that is probably really easy to explain. I have a VB.Net project with the JS object in it. Now how do I use the constants in "app?" I looked at the API I saw examples but in the VB.Net it says that the variable isn't defined which means I need to get the instance, which I understand is singleton. Please a little more help than just a single line ending in a ... would help.
Thanks,
Michael O'Dell
Michael_O_Dell@adobeforums.com Guest
-
jswota@adobeforums.com #6
Re: Basic VB.net and Javascript help
Hi Michael.
I've been working on something similar. Hopefully we can help each other out.
I created the following method that adds watermarks to a PDF file. It looks ugly in this text box but should copy into vb ok. Perhaps if you get it working you could please tell me how to get the instance of Acrobat to let go of the file. I.E. The method opens Acrobat to add the watermark, saves the files and closes it but Acrobat.exe is still left running in the TaskManager/Processes list. Until you terminate this process you cannot delete the file that you just added the watermark to because Acrobat is still using it.
Anyway. I hope this helps and look forward to hearing back from you.
Thanks,
Joel
Public Sub AddWaterMark(ByVal pdf_File As String, ByVal pdf_WaterMark As String)
If pdf_WaterMark <> "" Then
Dim pdf_PdDoc As New Acrobat.AcroPDDoc
Dim pdf_JSO As Object
If pdf_PdDoc.Open(pdf_File) Then
'Get JSO object
pdf_JSO = pdf_PdDoc.GetJSObject
'Set WaterMark color
Dim oColor As Object
oColor = pdf_JSO.color.black()
'Get page size for stamp placement
Dim pdf_Page As Acrobat.CAcroPDPage
Dim pg_Size As Object
Dim pg_Rotation As Object
pdf_Page = pdf_PdDoc.AcquirePage(0)
pg_Size = pdf_Page.GetSize
pg_Rotation = pdf_Page.GetRotate
'You have to play with these numbers to get the watermark exactly where you want it
Dim s_X As Double = 0
Dim s_Y As Double = 0
Dim s_Angle As Double = 90
'Add a text watermark.
'Function prototype:
'AddWatermarkFromText(cText, nTextAlign, cFont, nFontSize, oColor, nStart, nEnd, bOnTop, bOnScreen, bOnPrint, nHorizAlign, nVertAlign, nHorizValue, nVertValue, bPercentage, nScale, bFixedPrint, nRotation, nOpacity)
pdf_JSO.addWatermarkFromText(pdf_WaterMark, 0, "Helvetica", 16, oColor, 0, 0, True, True, True, 0, 0, s_X, s_Y, False, 1, False, s_Angle, 1)
End If
'Save doc
pdf_PdDoc.Save(Acrobat.PDSaveFlags.PDSaveIncrement al, pdf_File)
'Clean Up
pdf_JSO = Nothing
pdf_PdDoc = Nothing
End If
End Sub
jswota@adobeforums.com Guest
-
Michael_O_Dell@adobeforums.com #7
Re: Basic VB.net and Javascript help
Hi Joel,
My code does not have that problem, I compared our code and mine has this at the end:
' to clean up, get the Acrobat application,
' close Acrobat if there are no open documents.
Dim gApp As Acrobat.CAcroApp
gApp = CreateObject("AcroExch.App")
If gApp.GetNumAVDocs = 0 Then
gApp.CloseAllDocs()
gApp.Exit()
End If
Throw that in there and that seems like it would be the problem.
Michael_O_Dell@adobeforums.com Guest
-
jswota@adobeforums.com #8
Re: Basic VB.net and Javascript help
Thanks Michael. I'll check it out.
jswota@adobeforums.com Guest
-
Michael_O_Dell@adobeforums.com #9
Re: Basic VB.net and Javascript help
It seems like it is closing all of the open instances which should be one.
The one big problem that is minor is the text alignment. I would like it centered and I played wiht the numbers and I can only make it aligned left or right. Did you figure anything out with that?
Michael_O_Dell@adobeforums.com Guest
-
jswota@adobeforums.com #10
Re: Basic VB.net and Javascript help
When i used the nHorizAlign and nVertAlign in the addWatermarkFromText method i couldn't get the text where i wanted it so i opted to extract the page size and rotation so i could specifically calculate the location ot the text. You don't need to do this if you just want your text centered. I believe if you change the nHorizAlign to 1 and nVertAlign to 0 it will center your text on the page but don't quote me on that. Those are the numbers you want to play with. The possible value i think are 0,1,2.
The commented line just above the method lists the required parameters. Play around with these numbers to get exactly what you want. I wasn't able to get the nVertAlign to do anything by changing the values. Not sure why.
I posted something similar to this a couple of weeks ago that goes a little deeper into this matter at:
<http://www.adobeforums.com/webx/.59b703ca/0>
Hope this helps.
P.S. Thanks for the advice earlier. It looks like it will help. Also, if you good code for combining PDF files i would love to see it. I have it going but it's pretty buggy.
Thanks,
Joel
jswota@adobeforums.com Guest
-
Antony_Thomas@adobeforums.com #11
Re: Basic VB.net and Javascript help
I'm new to Adobe programming. How can include adobe acrobat page in visual basic 6 application.
Thanks
Antony
Get your dream Engineering Job
<http://antoonlinejobs.blogspot.com/>
Antony_Thomas@adobeforums.com Guest
-
Antony_Thomas@adobeforums.com #12
Re: Basic VB.net and Javascript help
In java script how to iterate a loop?
Thanks
<http://piping-jobs.blogspot.com>
Antony_Thomas@adobeforums.com Guest



Reply With Quote

