Javascript question (API) labels DYMO

Hi all.

APEX 4.2
11 GR 2 XE database.


I am trying to print labels directly from APEX through a library of JS of DYMO (DYMO label for javascript framework).
I want to fetch the XML code for the type of representation dynamically from the database instead of fixed this assignment in JS, which kind I can store all templates for labels in the database and find the one appropriate for the task, I do).
If I use the fixed code, it works very well, code looks like this (sheet of labels XML is assigned to the variable labelxml in the first few lines):
function printadres(labeltext )
{
    try
     { 
var labelxml = '<?xml version="1.0" encoding="utf-8"?>\
    <DieCutLabel Version="8.0" Units="twips">\
        <PaperOrientation>Landscape</PaperOrientation>\
        <Id>Address</Id>\
        <PaperName>30252 Address</PaperName>\
        <DrawCommands/>\
        <ObjectInfo>\
            <TextObject>\
                <Name>Text</Name>\
                <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />\
                <BackColor Alpha="0" Red="255" Green="255" Blue="255" />\
                <LinkedObjectName></LinkedObjectName>\
                <Rotation>Rotation0</Rotation>\
                <IsMirrored>False</IsMirrored>\
                <IsVariable>True</IsVariable>\
                <HorizontalAlignment>Left</HorizontalAlignment>\
                <VerticalAlignment>Middle</VerticalAlignment>\
                <TextFitMode>ShrinkToFit</TextFitMode>\
                <UseFullFontHeight>True</UseFullFontHeight>\
                <Verticalized>False</Verticalized>\
                <StyledText/>\
            </TextObject>\
            <Bounds X="332" Y="150" Width="4455" Height="1260" />\
        </ObjectInfo>\
    </DieCutLabel>';

          var label = dymo.label.framework.openLabelXml(labelxml);

          // set label text
          label.setObjectText("Text", labeltext);
                         
          // select printer to print on
          // for simplicity sake just use the first LabelWriter printer
          var printers = dymo.label.framework.getPrinters();
          if (printers.length == 0)
               throw "No DYMO printers are installed. Install DYMO printers.";

          var printerName = "";
          for (var i = 0; i < printers.length; ++i)
          {
               var printer = printers;
               if (printer.printerType == "LabelWriterPrinter")
               {
                    printerName = printer.name;
                    break;
               }
          }
                         
          if (printerName == "")
               throw "No LabelWriter printers found. Install LabelWriter printer";

          // finally print the label
          label.print(printerName);
     }
     catch(e)
     {
          alert(e.message || e);
     }
};
but when I try to fetch the same XML from a text field on my form it fails with a "getObjectByNameElement(): no object with name 'Text' was found" error which is a custom error from the DYMO library.
I'm unable to find the big difference in the 2 approaches. If I test the variable labelxml by putting it in an alert the value seems fine ( it contains the XML string which is in P11_LABELTEMPLATE which is exactly the same as the static assigned text in the previous example ).
The code then looks like this :
function printadres (labeltext)
{
VR;
{
var labelxml = $v ('P11_LABELTEMPLATE'); It's dynamic assignment that fails somehow

var label = dymo.label.framework.openLabelXml (labelxml);

the text of the label value
label.setObjectText ("Text", labeltext);

Select the printer to print on
for simplicity just use the first printer LabelWriter
var printers = dymo.label.framework.getPrinters ();
If (printers.length == 0)
launch 'no DYMO printer is installed. Install DYMO printers. « ;

var printerName = "";
for (var i = 0; i < printers.length; ++ I)
{
Printer printers [i] = var;
If (printer.printerType is "LabelWriterPrinter")
{
printerName = printer.name;
break;
}
}

If (printerName == "")
not launch "no printer found LabelWriter. Install printer LabelWriter ";

Finally, print the label
Label.Print (PrinterName);
}
catch (e)
{
Alert(e.message || e);
}
};
I'm not sure if this is an APEX or JS question/problem but I hope someone can point me in the right direction.

Regards
  Bas                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        

Hi Arie,

You have me headed in the right direction.
It seems to me that there is a CR/LF to CR conversion but in the end that did not really matter, I guess.

I just made a mistake by copying the XML in a database table. What I did the copy on any of the XML string in the code, including the backslash at the end of the line that is JS (continue on a new line) and does not part of the XML... .not too smart of me is it ;)
Please help out me.

Problem solved!

Kind regards
Bottom

Tags: Database

Similar Questions

  • Print labels DYMO 450

    I'm looking to print labels using a DYMO 450 directly from my app with a simple push of a button.  The labels would include information that is on the page, that they are printing.  What would be the best option for this?  Someone at - it examples of this work?

    So I found this and it looks like what I want to do, but I don't know where to put the code?  I don't know how to implement the solution.

    Javascript question (API) labels DYMO

  • JavaScript question - do not click on dates in a calendar

    We try on online tennis court booking site. When I click the calendar icon to select a date in the calendar, I can click on the date, but he does not at that date.

    Other browsers such as Chrome and Internet Explorer work fine. It just goes straight to the date I click.

    <"rel = 'nofollow' > http://demo3.onlinecourtreservations.com/Reservations.asp > demo version"

    <"rel = 'nofollow' > http://mum.onlinecourtreservations.com/Reservations.asp > our trial version."

    Here's what I sent to the developer and his answer is below.

    My Question: When you use the calendar for date selection tool, I noticed that it will not to the date on the calendar that I click. I can navigate using the arrows of day view and the view arrows week next to the icon of calendar very well.

    DEVELOPER RESPONSE: The calendar tool is based on javascript, so the security of your browser must allow scripts. To do this, the simplest method is to add your site to the "trusted sites" on your browser.

    The steps I've tried:
    1. the reset of the functionality of Firefox
    2. clear all history
    3. start in Safe Mode
    4. check to make sure that javaScript is enabled and it is.

    I wonder why this works fine in Chrome and Internet Explorer and not Firefox.

    Could someone help me solve the problem?

    Thank you.

    If you use this script, you can change it?

    The pop-up tries to submit a form hidden in the main window using a standard, old SEO method. You can correct the script in the pop-up window, or you can create a reference in the main window.

    Method #1:

    Change the code in the popup

    reservation_window.frmCalendar.submit();
    

    for this

    reservation_window.document.forms['frmCalendar'].submit();
    

    Method #2:

    In the main window, create a global script variable that creates the missing reference:

    window.frmCalendar = document.forms['frmCalendar'];
    

    Once solve you this problem, there is a new number. Web site empty, and when you view the source, you see that there is a problem with one of the hidden form parameters.

    Microsoft VBScript runtime error '800a000d'
    Type mismatch: 'CInt'
    /demo/common/reservationssheet/script.asp, line 25
    

    Since it is on the server, I don't know what goes wrong, but the script apparently don't deal well with a time value start missing. For what it's worth, I get the same error in IE8.

  • Tablet - Question API

    Hello

    because I'm not too familiar with the BlackBerry Tablet API or the Adobe AIR APIs, I have two questions on whether or not it is possible:

    1. can I configure VPN appliance settings programmatically?

    2. can I lock or wipe the BlackBerry Playbook by programming?

    Thanks for all the answers!

    I personally haven't seen a demo where the person can lock the screen.  He could be here, I've just not seen it.

    With regard to wiping.  If there is a Java API for that, then perhaps it would be possible in a future API.  I'm just surprised that such an API is on the side of the phone.

  • Simple Javascript question

    Please forgive me, I am very new to JavaScript and Acrobat.

    Can someone tell me the phrase I would use to several a number entered by a user; which would be multiplied by a fixed number? Please see image:

    The user number of backpacks, they enter the first area, the second box would have several sales of 50.

    Please let me know if you have any question. I spent some time trying to get this to work, everything I try the product and error.

    Your help is very appreciated!

    Hi rachelNS,

    You can send me a sample form and I would try it for you.

    Then you check the script on your side. Also, I would like to know what is the version of Acrobat you are using?

    Kind regards

    Ajlan Huda.

  • strings in JavaScript question and location

    Hi all

    Not sure that this is right forum for my question... I have when even a few constant strings in my JavaScript files that I have run these scripts from my inDesign plugin in C/C++ code. Anyone know how I can make localization in scripts files (I don't know how support us localization in C / C ++ files).

    TIA,

    MOR

    See "Location ExtendScript strings" in the JavaScript Tools Guide.

  • JavaScript question

    I use Firefox 26.0, and now when I try to connect to Gmail, it shows "JavaScript must be enabled so that you can use Gmail in standard mode. However, it seems that JavaScript is disabled or not supported by your browser. To use standard view, enable JavaScript by changing your browser options, then try again. »

    I went through all the tabs under 'Options', but still can't find a way to solve the problem. Help, please!

    Hello

    In Firefox 23, as part of an effort to simplify the Firefox options define and protect users against unintentially damage their Firefox, the option to disable JavaScript has been removed from the Options of Firefox window.

    However, the ability to disable JavaScript was will not be deleted from Firefox entirely. You can always go to about: config or by installing an add-on.

    Subject: config

    1. In the address bar, type "subject: config" (with no quotes), and then press ENTER.
    2. Click on "I'll be careful, I promise".
    3. In the search bar, search for "javascript.enabled" (with no quotes).
    4. Click with the right button on the result, named "javascript.enabled" and click on "Toggle". JavaScript is currently disabled.

    To re - enable JavaScript, repeat these steps.

    Add - ons

    You can also install an add-on that allows you to disable JavaScript, such as

    • No-Script (to disable JavaScript on a per page basis, as needed)
    • QuickJava (to disable and enable JavaScript, automatic loading of images and other content easily)
    • SettingSanity (add deleted options for JavaScript, JavaScript advanced settings, loading images and the display of the tab bar)

    Thank you and I hope this helps!

  • Question on labels on Satellite P200-144

    Hello

    I noticed a few differences for European models of P200. First of all, where is the label of Harmon speakers ' Kardon beside the jump key.
    I also notcied that the Satellite has black light fabric-type of paper (dark), some of you have the same because it is abit boring.

    Thank you
    Neo-Tech

    Hello

    Can you please send part of your laptop model number? It must be something like PSPBGE-0xxxxxxx. One of my friends has P200 and I want to compare with its model of laptop.

  • Tips: JavaScript Question

    Beginner tips:

    1. how to express default script date today

    2. entry by default convert lowercase to uppercase

    Thank you

    Hello

    to complete todays date use FormCalc in the docReady event.

    if ($.isNull) then
         $ = Num2Date(Date(), "DD/MM/YYYY")
    else
         $.rawValue
    endif
    

    To change the lower case to upper case using JavaScript in your field change event.

    xfa.event.change = xfa.event.change.toUpperCase();
    
  • Please help with javascript question

    Hi all

    So ive got this piece of javascript-

    $("#verse_inscriptions").on ('change', function() {}

    verse of the var = $(this).children("option:selected").val();)

    If (verse! = "0") {}

    $("#textarea").val ($("#textarea").val () + "" + verse);

    calculateTotal();

    }

    });

    This page http://www.milesmemorials.com/product-GH54.html that I need is to adapt it so that it will allow this function to arrive while also inserting the same information into the textarea - here

    < textarea = "textarea2" id = "textarea2" name > < / textarea >

    So basically I have 2 forms, the first is where customers make their choices/selections and the second form retrieves these choices and inserts them in form2 by attributes "onchange", but the piece of code above that from occur (only on this part of the form 'inscriptions and verses' and 'textarea', which, as you can see both are interrelated).

    Can someone help me with this? I appreciate all help.

    Sorry it's my typo (extra '} ')

    $("#verse_inscriptions").on("change", function() {
            var verse = $(this).val();
            if(verse == "0") verse = "";
            $("#textarea, #textarea2").val(verse);
            processTextarea();
    });
    

    --

    Kenneth Kawamoto

    http://www.materiaprima.co.UK/

  • Another image to the random/javascript question

    So I try to find the best way to select the 4 images (out of reach of 8 images) and present them on a page at random. No movement or transitions not needed - just a way every time someone visits the page a random selection of 4 of the 8 images displayed. My current HTML looks like this:

    < div id = "slider" >
    < ul id = "randomSlide" >
    <! - 1 - >
    < li >

    "< a href="path/to/someotherpage.html "> < img alt ="alt text"src="img/1.jpg"/ > < / a >

    < /li >

    .....

    < /ul >

    < / div >

    So any suggestions on how to fix this? The jQuery plug-ins? Advice?

    I have not tested this on a live server, but it works perfectly on the spot. Put the following script immediately before the closing on the page tag:

    
    

    Obviously, you change the values of the src and url in each element of the array.

    What this did that create an array of objects containing the name of the image and its associated url. The table is sorted then randomly, and a loop that runs four times is used to fill the "randomSlide" unordered list, replacing the href and src attributes. I assumed that the images are in a folder called "images". Otherwise, change the value to ' images /' in the loop at the end of the script.

    When I tested it on the spot, I used # for the default href attribute and an empty string for the CBC in each tag. Since some people may have JavaScript disabled, it may be better to use actual values. However, this could change once the page loads images. The problem is that you can not access the unordered list until it has loaded into the DOM. The alternative would be to sort the array and preload the images, but this will slow down the display of the entire page.

    A solution on the server side would be much more effective.

  • FormCalc vs JavaScript question

    Well, then to be consistent throughout my form I would use JavaScript throughout my form.  In addition, it is easier to use.  Unfortunately, there is a behavior in FormCalc I can't reproduce in JavaScript, and I need it to work.  Here's the script in FormCalc

    var vnum = _Body.count
    var selection = xfa.host.messageBox ("attention! You are about to permanently delete this entry.  Are you sure you want to continue? "," danger! ", 3, 2).

    If ((vnum == (this.parent.index + 1)) & (vnum <>1) & (choice == 4)) then
    Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = "2"
    endif

    If (choice == 4) then
    _Body.removeInstance (this.parent.index)
    endif

    and here is my attempt to replace using JavaScript

    var vnum = _Body.count;
    var selection = xfa.host.messageBox ("attention! You are about to permanently delete this entry.  Are you sure you want to continue? «, "danger!", 3, 2);»

    If ((vnum == (this.parent.index + 1)) & & (vnum! = 1) & & (choice == 4))
    Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = '2';

    If (choice is 4)
    _Body.removeInstance (this.parent.index);

    I tested it on and I know that the problem occurs with the line

    Body [this.parent.index - 1]. Radio_Button_Subform.Radio_Button_Group.RawValue = '2';

    However, I do not understand why this reference is not valid JavaScript when it worked in FormCalc, and I don't know how to operate it.

    Thanks for your help.

    Hello

    For the javascript version replace youre code with the following:

    xfa.resolveNode ("Body [" +(vnum-2) +""].. ") RawValue Radio_Button_Subform.Any_other_property_of_this_type') = '2 ';

    Also check fix, hope this is what you need.

    BR

  • JavaScript question calling location.href

    Hello

    I'm calling a function javascript to the click event of a command button.
    function test1() {}

    Alert ("Simple alert");
    Location.href='/context/faces/test';
    Window.Location='/Context/faces/test';

    }

    The redirect does not work the method here. If I Uncomment alert in the method and accept the alert from the rediredirection that happens. Someone tell me the issue here? Is there another way to have the redirect using javascript?

    Thank you
    Bastien

    Yes, that seems correct (I wanted to say in the case of page 2, back to page 1). You use a binding of the ADF, and if so, what are the conditions of discount for the iterators on page 1?

    John

  • question of label simple forum

    I have a question about Flash/Dreamweaver integration. Where can I post it?
    Sophie

    Sophia,

    > I have a question about Flash/Dreamweaver integration.
    > Where can I post it?

    Personally, I would probably myself, "is this really a question.
    on the integration between Flash and Dreamweaver specifically, or is it a
    question about Flash and HTML? "If Dreamweaver specifically, I would
    probably post on the Dreamweaver forum. If HTML, I would probably show
    here.

    David
    Stiller (at) quip (dot) net
    Dev test: http://www.quip.net/blog/
    "Luck is the residue of good design."

  • JavaScript question for document.domain

    Hello

    How is it when I use 'document.domain' in my JavaScript, the alert no longer works?

    The JS function below, when it is called, the alert does not work:
    function showMessage() {}
    document. Domain = "cfoutput <>#CGI. Server_name #"" < / cfoutput > ";"
    Alert ("Message here");
    }

    Thanks in advance!

    OK sure, here is my tell...















    Display the data in the parent Page:


Maybe you are looking for

  • How can I save a complete set of bookmarks at once?

    After searching ERP/CRM info, I found several interesting located offering valuable information. Each of these sites was opened in another window. In doing so, I have gathered a series of tabs, each one connected to a specific Web site.How can I add

  • Cannot delete a file:"FILE IS in USE BY ANOTHER PROGRAM"

    I try to delete a file and get the message'File is used by another person or program ". The file has been around for several weeks.  I rebooted several times.I always get the message. Is it possible to get rid of this file?

  • XP updates with - CUSTOM - in file name - does that mean?

    I was download updated ISO every month from June 2008 in order to make some kind of XP SP4 for all XP systems I have service.  In 2010, I noticed there are duplicate files update kb they say KB # x 86 - ENU and the other says KB # x 86-ENU-CUSTOM whe

  • Update error code window XPwindow 0x8024400A

    Hey, when I go to the update of the window, I get a 0x8024400A error code

  • Explore ntdll.dll problem

    Works with XP and problems when you use explore (not IE) but in my computer. Looking around, I found is an error message saying error compaq - rba.exe, module failed ntdll.dll. Sometimes explore works nothing happens, incompatible. Whenever I log in