Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
2

nach eingabe eines Textes soll ein barcode angezeigt werden

Contributor ,
Jun 27, 2023 Jun 27, 2023

Hallo ich möchte das so haben das wenn ich einen bestimmten text eintrage das mir dann der dazugehörige Barcode angezeigt wird gitb es eine möglichkeit?

 

bis jetzt laden wir immer den barcode als Bild hoch das ist aber lästig gibt es da irgeneine möglichkeit 

wir benutzen die datei auf der arbeit 

da wo artikel und EAN steht soll Barcode rein der zu einem Bestimmten Text gehört, ich mölchte nur den Text eintragen und der barcode soll automatisch erscheinen .

Unbenannt.png

 

 

 

wie soll das gehen.

 

gibt es da ein Java-Script

 

Mit freundlichen Grüßen 

Marcel  Freiburg

TOPICS
How to , JavaScript , PDF
2.4K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

[ I hope it's OK to answer in English, it's easier for me, and it will benefit others with similar questions, this site has a translation feature that allows to translate text into a number of different languages ]

 

As long as you have access to a font that crates the correct barcode you require, and you can express the text in teh format requried for this particular barcode, you can do this in a form field. You can find some EAN fonts here: https://graphicore.github.io/librebarcode/documentation/ean13.html

 

You would install such a font on your system, and then select that font for the barcode text field. Once that is done, you should see the barcode when you assign a value to that field. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 29, 2023 Jun 29, 2023

mir geht es darum das wenn ich beispiel test dareinschreibe das der dann dazugehörigen Barcode erstellen mit einer festen nummer oder Beispiel Schrauben die haben ja eine Feste nummer ich möchte nut den Text reinschreiben und der soll mir dann den Barcode dazu anzeigen geht das und wie? danke im vorraus 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

This is just standard JavaScript programming. You would need a way to map text to a code, which in turn would then result in the correct barcode. Something like this might work when used as the custom calculation script for the barcode field:

 

// Get the text from the field "SomeText", then do a lookup operation to find the code for the corresponding barcode and display 
// that barcode in this field. This requires that the field is confiured with the correct barcode font. 

// ideally, the folliwing "map" would be stored in a document level script
// data mapping
var mapToBarcode = { 
"Product1" : "o:ERJGLN*agdcdc+>",
"Product2" : "o:ERJGLN*abbcda+>",
// add more products
};

// the text we need to map:
var textToMap = this.getField("SomeText").value;
var textToDisplay = "";

if (textToMap) {
    textToDisplay  = mapToBarcode[textToMap];
    if (typeof textToDisplay == "undefined") {
        // cannot map the product code
        console.println("ERROR: Cannot map product: " + textToMap);
        textToDisplay = "";
    }
    event.value = textToDisplay;
}

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 29, 2023 Jun 29, 2023

hast du eine erklärung wie ich das machen kann? bin zu doof dafür

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 29, 2023 Jun 29, 2023

Which part of the solution? The font part or the script part? For the font part, just download the font I referenced earlier (you need to search for "Download" on that page, and you should find a link to the download page towards the end of the page). There are multiple TTF (True Type Font) files in the ZIP file, you need to figure out what barcode you need (I suspect it's EAN13, but only you know for sure). Install the font file - there is a good chance that double-clicking on the file will initiate the installation. Once installed, you need to figure out what you need to type in order to get the desired barcode. It's not just the characters you want in the code, there is more involved. Lookup the documentation for the font to find out mroe about that. This is not my field of expertise. 

 

If you want to know more about the JavaScript part, that's a bit more involved. Have you done any JavaScript proramming for Acrobat? 

 

If it's about

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 29, 2023 Jun 29, 2023

Es geht mir um den Skript.

Bei unserer Ware sind feste Barcodes an der Ware und wenn ich den Artikel eingebe soll der Barcode zu der Ware auftauchen damit die Kasse den abscannen kann.

 

Beispiel: MDF Ahorn 3mm = 4001234567891

Ich möchte aber nur mdf Ahorn 3mm eingeben das der Code dann kommt so wie er oben steht.

 

Geht sowas ?

 

Ich habe keine Kenntnisse über Java Skript.

 

Es sind beschreibbare PDFs 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2023 Jun 30, 2023

It turns out, this is a little bit more complicated than I thought. I wrote up a short tutorial here: 

http://khkonsulting.com/2023/06/ean-upc-barcodes-in-pdf-forms/

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2023 Jun 30, 2023

Nice one! I encountered the same issue with this font as you did when I tried to help the OP with their problem, but didn't take the extra step of figuring out how to solve it. I agree that the documentation for this font is lacking, as it suggests it can be used "out of the box", when that's obviously not the case, at least not in PDF files.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 30, 2023 Jun 30, 2023

It seems to work with other major applications - for some of them after flipping some hard to find switches, Acrobat has to be different 😉 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023
	/* Dies basiert auf einem VB-Skript von https://github.com/graphicore/librebarcode/issues/44	Eingabe: String mit 12 Ziffern (der Barcode ohne Prüfsumme)	       oder	       Zeichenfolge mit 13 Ziffern (der Barcode mit der Prüfsumme)	return: eine Zeichenfolge, die die „kompatible Eingabemethode“ für den Barcode verwendet	*/
	ean13 = ""; // den Rückgabestring initialisieren
	// Haben wir eine rein numerische Eingabe?	if (!/\d+/.test(ch_in)) {		console.println("FEHLER: Eingabezeichenfolge ist nicht numerisch - " + ch_in);		zurückkehren "";	}
	// Haben wir 12 oder 13 Eingabezeichen?	if (ch_in.length == 12) {		// Berechne die Prüfsumme		var Prüfsumme = 0;		für (var i = 0; i < 12; i++) {			var digit = Number(ch_in.charAt(i));			if (i % 2) {				Prüfsumme += 3 * Ziffer;			} anders {				Prüfsumme += Ziffer;			}		}		Prüfsumme = (10 - (Prüfsumme % 10)) % 10;		// Füge die neue Ziffer am Ende der Eingabezeichenfolge hinzu		ch_in = ch_in.toString() + checksum.toString();	} else if (ch_in.length == 13) {		// nichts zu tun, wir haben bereits eine Prüfsumme	} anders {		console.println("FEHLER: Falsche Zeichenanzahl - " + ch_in);		zurückkehren "";	}
	// An diesem Punkt haben wir eine 13-String-Eingabe	ean13 = ch_in.charAt(0);	ean13 = ean13 + String.fromCharCode(65 + Number(ch_in.charAt(1)));
	var first = Number(ch_in.charAt(0));	für (var i = 2; i < 7; i++) {		var tableA = false;		Schalter (i) {			Fall 2:				if (first >= 0 && first <= 3) {					TabelleA = wahr;				}				brechen;			Fall 3:				Schalter (zuerst) {					Fall 0:					Fall 4:					Fall 7:					Fall 8:						TabelleA = wahr;						brechen;				}				brechen;			Fall 4:				Schalter (zuerst) {					Fall 0:					Fall 1:					Fall 4:					Fall 5:					Fall 9:						TabelleA = wahr;						brechen;				}				brechen;			Fall 5:				Schalter (zuerst) {					Fall 0:					Fall 2:					Fall 5:					Fall 6:					Fall 7:						TabelleA = wahr;						brechen;				}			Fall 6:				Schalter (zuerst) {					Fall 0:					Fall 3:					Fall 6:					Fall 9:						TabelleA = wahr;						brechen;				}				brechen;		}		if (tableA) {			ean13 = ean13 + String.fromCharCode(65 + Number(ch_in.charAt(i)));		} anders {			ean13 = ean13 + String.fromCharCode(75 + Number(ch_in.charAt(i)));		}	}	// füge das mittlere Trennzeichen hinzu	ean13 = ean13 + "*";	für (i = 7; i < 13; i++) {		ean13 = ean13 + String.fromCharCode(97 + Number(ch_in.charAt(i)));	}	ean13 = ean13 + "+";	return ean13;}



WAS MUSS ICH DEN KOPIEREN UND EINFÜGEN UND WO BEKOMME IMMER EINE FEHLERMELDUNG DAS WAS IN EINER ZEILE NICHT PASST
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

Was ist denn die genaue Fehlermeldung? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

die frage ab wann soll ich einfugen und bis wohin 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023
 
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

You can't translate code. Some words have to appear in the original English, like case, if, break, for, etc.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

die frage ab wo soll ich den Skriot kopieren

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

From the post linked to by KHK above...

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

aber was muss ich alles kopiereen und wo muss ich dies einfügen kannst du mir das anhand eines Bild zeigen 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

It's all explained very well in the tutorial, as far as I can see. If you can't find a specific command, let us know what it is, and what version of Acrobat you have, and we'll help you find it.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

im Javasript komme ich nicht klar ab wo ich was kopieren soll bekomme dann die Meldung die ich vorhin geschickt habe und wo finde ich die Dokumentebene

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

ich komme nicht weiter

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

Here is how to get to the Document JavaScripts in the English/macOS version of Acrobat: Use the tool search function and search for "JavaScript", this will bring up all the relevant tools. You should see "Document JavaScripts" listed, and you should be able to click on it:

 

KarlHeinzKremer_0-1688239766343.png

 

Once that is done, you should see the actual Document JavaScripts dialog:

 

KarlHeinzKremer_1-1688239845206.png

 

 

Add the script name as indicated in my post ("convert_ean13") and dlick on the "Add" button. This will bring up the editor. In my post, you will see text that is in a mono-spaced font that starts with "function convert_ean13(ch_in) {" and ends with a single "}". That's the portion that you need to copy. Once you save this script, you can close the JavaScript tool by clicking on the Close button in the toolbar. 

 

Then create your form fields. I assume you know how to do that because your screenshot already contains form fields. I am starting with a blank PDF file and I am adding two text fields, one named "SomeText" as indicated in my post and a second one called BarCode. You do not have to do anything special with the "SomeText" field, but for the "BarCode" field, bring up the properties dialog. You should see something like this:

 

KarlHeinzKremer_0-1688240323723.png

 

 

We will make changes on the General and the Calculate tab. On the General tab, check the "Read Only" checkbox, then switch to the Calculate tab. 

KarlHeinzKremer_1-1688240401626.png

 

 

Here you want to select the "Custom calculation script" option and then click on the associated Enter button. The script we are using here is again from my post, and it goes from "// Get the text from the field "SomeText",..." to again a single "}". Copy and paste that into the editor. Save the script and close the properties dialog. To test the script, click on "Preview" in Acrobat's Prepare Form toolbar. When you now type "Product1" into the "SomeText" field and hit the tab key, you should see "4AOBEMO*deeefb+" in the barcode field. This is the string that will become the actual barcode, once we configure the barcode font, so open up the properties dialog for the BarCode field again, but this time we go to the "Appearance" tab and select the correct font (which you should have installed before you started working in Acrobat, otherwise you will have to save your form and restart Acrobat):

 

KarlHeinzKremer_2-1688240775795.png

 

 

This will show the barcode in your form field. 

 

I just walked through all these steps in order to capture the screenshots, and I did not end up with an error message, so I know it works. If you get an error message, then you are doing something different from what I've done. 

 

If this is still a bit too complex for you, you may want to consider to hire somebody to do that for you (and yes, I am available for jobs like this, as is try67 and others on this site). 

 

 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

was würdest dafür bekommen wenn du das für mich machen könntest 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jul 01, 2023 Jul 01, 2023

ich weiß nicht genau was ich von dem Java-Script kopieren soll 

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jul 01, 2023 Jul 01, 2023

Alles was in meinem Post in Courier (Font) erscheint. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines