上野家のホームページ
ナーマル,マリン,ココ
[
新規
|
一覧
|
検索
|
最新
|
ヘルプ
]
開発/Barcode/QRコード/Google Chart APIを使ってQRコードを作成する
をテンプレートにして作成
資料室
開発/Barcode/QRコード/Google Chart APIを使ってQRコードを作成する をテンプレートにして作成
[
差分
|
バックアップ
|
リロード
]
[ ]
開始行:
* Google Chart APIを使ってQRコードを作成する
Google ChartsはGoogleがオンラインで提供しているグラフ描画...
また,これをWEBサービス化したのがGoogle Chart APIのようだ...
Google Chart APIでは,QRコード作成もサポートされている。~
利用するには''インターネットにアクセスできる環境からでな...
問題としては,Google側のサービスの不具合や,API仕様が突然...
Googleから&color(#ff0000){''03/14/2019をもってこのサービ...
まあ,復活してもいつまで使えるかはわかりません・・・~
代替えサービスとしては,[[Google Chart APIの代わりのサー...
** Goolge Chart APIって
[[Google Charts>https://developers.google.com/chart/]]は...
Googleは,WEB API(Google Chart API)としてもサービスして...
残念ながらGoogle Chart APIでは''MicroQRコードには対応して...
使用例:~
http://chart.apis.google.com/chart?cht=qr&chs=100x100&ch...
//実行例:(%%03/14/2019以降は表示されないと思う。%% 03/2...
//#iframe(http://chart.apis.google.com/chart?cht=qr&chs=1...
wgetコマンドで直接QRコード画像が得られる。~
> wget -O yueno.png "http://chart.apis.google.com/chart?...
*** Google Chart APIでのQRコード用パラメータ
使い方は,以下のような形式で指定する。~
http://chart.apis.google.com/chart?cht=qr&chs=<QRコード...
|パラメータ |必須 or オプショ...
|cht=qr |必須 ...
|chs=<幅>x<高さ> |必須 ...
|chl=<入力データ> |必須 ...
|choe=<出力エンコードタイプ> |オプション ...
|chld=<エラー訂正レベル> or <マージン> |オプション ...
|chco=<色> |オプション ...
** Microsoft EXCELで使ってみる
以下の''VBAマクロ''をEXCELの標準モジュールに追加する。~
#code(vb,nonumber){{
'
' QRimg(QRコード化する文字列 as string)
'
' by Yuji ueno
'
Public Function QRimg(ByVal str As String) As String
Dim TopPosition As Double
Dim LeftPosition As Double
Dim wkSheet As Worksheet
Dim xRange As Range
Dim xAddr As String
Dim QRShape As Shape
' 文字列がなかったらエラーで終了
If Len(str) = 0 Then
QRimg = "False"
Exit Function
End If
If TypeName(Application.Caller) <> "Range" Then
QRimg = "False"
Exit Function
End If
' 呼ばれたワークシートを取得
Set wkSheet = Application.Caller.Worksheet
Set xRange = Application.Caller
xAddr = xRange.Address
' 前にセルに貼られていた画像を削除
Range(xAddr).Select
For Each selectRange In Selection
For Each myShape In wkSheet.Shapes
Set myRange = Range(myShape.TopLeftCell, mySh...
If Intersect(myRange, Range(xAddr)) Is Nothin...
myShape.Delete
End If
Next
Next
' 画像の位置
TopPosition = xRange.Top
LeftPosition = xRange.Left
' QRコードを作成するリクエストを作成(Google Chart AP...
url = "http://chart.apis.google.com/chart?cht=qr&chs=...
'url = "https://bwipjs-api.metafloor.com/?bcid=qrcode...
If Not url = "" Then
' QRコードのイメージを表示
Set QRShape = wkSheet.Shapes.AddPicture(url, Link...
End If
QRimg = ""
End Function
}}
ワークシートの''B1''に「=QRimg(A1)」と入れて,''A1''にQR...
#ref(excel.png,,70%)
* Google Chart APIの代わりのサービス
使えなくなったGoogle Chart APIの代わりになるようなサービ...
** Online Barcode API
[[Online Bardode API>https://github.com/metafloor/bwip-js...
QRコードだけでなく一般的なほとんどのバーコードを作成する...
MicroQRコードにも対応している。~
WEB APIはオープンソース・ソフトウェアなので,自前のサーバ...
使用例:
https://bwipjs-api.metafloor.com/?bcid=qrcode&text=https...
https://bwipjs-api.metafloor.com/?bcid=microqrcode&versi...
//上記の実行例:
//#iframe(https://bwipjs-api.metafloor.com/?bcid=qrcode&t...
curlを使って,直接QRコード画像が得られます。
> curl -o yueno.png "https://bwipjs-api.metafloor.com/?b...
** QuickChart
Google Cart APIのようなサービスとして[[QuickChart>http://...
QRコード以外は,[[Chart.js>https://www.chartjs.org/]]を使...
MicroQRコードには対応していない。~
WEB APIとしていつまでサービスしてくれるかは不明だが,オー...
使用例:
https://quickchart.io/qr?size=100&text=https://yueno.net
//上記の実行例:
//#iframe(https://quickchart.io/qr?size=100&text=http://w...
curlを使って,直接QRコード画像が得られます。
> curl -o yueno.png "https://quickchart.io/qr?size=100&t...
** QR code API
[[QR code API>http://goqr.me/api/]]という,QRコードを作成...
残念ながらMicroQRコードには対応していないようだ。~
APIに関するドキュメントは,[[こちらのページ>http://goqr.m...
使い方は簡単です。
https://api.qrserver.com/v1/create-qr-code/?data=https:/...
とすればOK。
//上記の実行してみると,
//#iframe(https://api.qrserver.com/v1/create-qr-code/?dat...
//のようにQRコードが取得できます。
//
curlを使って,直接QRコード画像が得られます。
> curl -o nalux.png "https://api.qrserver.com/v1/create-...
終了行:
* Google Chart APIを使ってQRコードを作成する
Google ChartsはGoogleがオンラインで提供しているグラフ描画...
また,これをWEBサービス化したのがGoogle Chart APIのようだ...
Google Chart APIでは,QRコード作成もサポートされている。~
利用するには''インターネットにアクセスできる環境からでな...
問題としては,Google側のサービスの不具合や,API仕様が突然...
Googleから&color(#ff0000){''03/14/2019をもってこのサービ...
まあ,復活してもいつまで使えるかはわかりません・・・~
代替えサービスとしては,[[Google Chart APIの代わりのサー...
** Goolge Chart APIって
[[Google Charts>https://developers.google.com/chart/]]は...
Googleは,WEB API(Google Chart API)としてもサービスして...
残念ながらGoogle Chart APIでは''MicroQRコードには対応して...
使用例:~
http://chart.apis.google.com/chart?cht=qr&chs=100x100&ch...
//実行例:(%%03/14/2019以降は表示されないと思う。%% 03/2...
//#iframe(http://chart.apis.google.com/chart?cht=qr&chs=1...
wgetコマンドで直接QRコード画像が得られる。~
> wget -O yueno.png "http://chart.apis.google.com/chart?...
*** Google Chart APIでのQRコード用パラメータ
使い方は,以下のような形式で指定する。~
http://chart.apis.google.com/chart?cht=qr&chs=<QRコード...
|パラメータ |必須 or オプショ...
|cht=qr |必須 ...
|chs=<幅>x<高さ> |必須 ...
|chl=<入力データ> |必須 ...
|choe=<出力エンコードタイプ> |オプション ...
|chld=<エラー訂正レベル> or <マージン> |オプション ...
|chco=<色> |オプション ...
** Microsoft EXCELで使ってみる
以下の''VBAマクロ''をEXCELの標準モジュールに追加する。~
#code(vb,nonumber){{
'
' QRimg(QRコード化する文字列 as string)
'
' by Yuji ueno
'
Public Function QRimg(ByVal str As String) As String
Dim TopPosition As Double
Dim LeftPosition As Double
Dim wkSheet As Worksheet
Dim xRange As Range
Dim xAddr As String
Dim QRShape As Shape
' 文字列がなかったらエラーで終了
If Len(str) = 0 Then
QRimg = "False"
Exit Function
End If
If TypeName(Application.Caller) <> "Range" Then
QRimg = "False"
Exit Function
End If
' 呼ばれたワークシートを取得
Set wkSheet = Application.Caller.Worksheet
Set xRange = Application.Caller
xAddr = xRange.Address
' 前にセルに貼られていた画像を削除
Range(xAddr).Select
For Each selectRange In Selection
For Each myShape In wkSheet.Shapes
Set myRange = Range(myShape.TopLeftCell, mySh...
If Intersect(myRange, Range(xAddr)) Is Nothin...
myShape.Delete
End If
Next
Next
' 画像の位置
TopPosition = xRange.Top
LeftPosition = xRange.Left
' QRコードを作成するリクエストを作成(Google Chart AP...
url = "http://chart.apis.google.com/chart?cht=qr&chs=...
'url = "https://bwipjs-api.metafloor.com/?bcid=qrcode...
If Not url = "" Then
' QRコードのイメージを表示
Set QRShape = wkSheet.Shapes.AddPicture(url, Link...
End If
QRimg = ""
End Function
}}
ワークシートの''B1''に「=QRimg(A1)」と入れて,''A1''にQR...
#ref(excel.png,,70%)
* Google Chart APIの代わりのサービス
使えなくなったGoogle Chart APIの代わりになるようなサービ...
** Online Barcode API
[[Online Bardode API>https://github.com/metafloor/bwip-js...
QRコードだけでなく一般的なほとんどのバーコードを作成する...
MicroQRコードにも対応している。~
WEB APIはオープンソース・ソフトウェアなので,自前のサーバ...
使用例:
https://bwipjs-api.metafloor.com/?bcid=qrcode&text=https...
https://bwipjs-api.metafloor.com/?bcid=microqrcode&versi...
//上記の実行例:
//#iframe(https://bwipjs-api.metafloor.com/?bcid=qrcode&t...
curlを使って,直接QRコード画像が得られます。
> curl -o yueno.png "https://bwipjs-api.metafloor.com/?b...
** QuickChart
Google Cart APIのようなサービスとして[[QuickChart>http://...
QRコード以外は,[[Chart.js>https://www.chartjs.org/]]を使...
MicroQRコードには対応していない。~
WEB APIとしていつまでサービスしてくれるかは不明だが,オー...
使用例:
https://quickchart.io/qr?size=100&text=https://yueno.net
//上記の実行例:
//#iframe(https://quickchart.io/qr?size=100&text=http://w...
curlを使って,直接QRコード画像が得られます。
> curl -o yueno.png "https://quickchart.io/qr?size=100&t...
** QR code API
[[QR code API>http://goqr.me/api/]]という,QRコードを作成...
残念ながらMicroQRコードには対応していないようだ。~
APIに関するドキュメントは,[[こちらのページ>http://goqr.m...
使い方は簡単です。
https://api.qrserver.com/v1/create-qr-code/?data=https:/...
とすればOK。
//上記の実行してみると,
//#iframe(https://api.qrserver.com/v1/create-qr-code/?dat...
//のようにQRコードが取得できます。
//
curlを使って,直接QRコード画像が得られます。
> curl -o nalux.png "https://api.qrserver.com/v1/create-...
ページ名:
Counter: 0, today: 0, yesterday: 0
Copyright©2008 Yuji Ueno All Rights Reserved.
ログイン
ユーザ名:
パスワード:
IDとパスワードを記憶
パスワード紛失
メインメニュー
ホーム
でぶlog
資料室
最新ページ一覧
全ページ一覧
ヘルプ
フォーラム
お問い合わせ